Data Lens Developer's Guide

Retrieving a Query's Source

To copy or modify a query, you first need to retrieve its source code. To to this, you send a GET request with the query ID to the Data Lens REST API. See Creating a Query for details on creating queries.

To fetch the source code of a query, make an authenticated GET request to the following resource:
http://datalens.api.here.com/v1/queries/[query_id]?app_id={YOUR_APP_ID}&app_code={YOUR_APP_CODE}
where [query_id] is the unique identifier of your query.

You will receive a response body that contains metadata about the query in a JSON object, including the query source code (in the query property), but also information such as the query ID, description and tags (if defined).

To modify a query, copy the code inside the query property, edit it, and post it to the Data Lens REST API as usual. See in Creating a Query for details.

To retrieve a query's source code in Postman (see Using Postman):

  1. Paste the URL above into Postman's URL bar, replacing [query_id] with the ID of the query whose source code you want.
  2. Set the request type (next to the URL bar) to GET.
  3. Click Send.

The response will be a JSON object containing the query result. It will look something like this:

{
        "origin": "user",
        "description": null,
        "tags": [],
        "updated_at": "2017-02-10T14:33:50Z",
        "visibility": "private",
        "dataset": "90af668484394fa782cc103409cafe39",
        "query": {
        "metrics": [
          "avg_magnitude",
          "count"
        ],
        "facets": [
          "Src"
        ],
        "namespace": {
          "count": {
          "source": [
            "region"
          ],
          "apply": [
            {
            "type": "aggregate",
            "fn": "count"
            }
          ]
          },
          "avg_magnitude": {
          "source": [
            "Magnitude"
          ],
          "apply": [
            {
            "type": "aggregate",
            "fn": "average"
            }
          ]
          }
        },
        "order": [
          {
          "Src": "asc"
          },
          {
          "count": "desc"
          }
        ],
        "dataset": "90af668484394fa782cc103409cafe39"
        },
        "id": "6fad8374f8bc4470b1d71f802cc5537d",
        "kind": "datalens#query",
        "created_at": "2017-02-10T14:33:50Z",
        "request_id": "011f956a-42b9-4e23-ce02-af2e3002d0dc",
        "estimated_rows": 13
}

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.