API Workflows

The HERE platform allows users to work directly with the REST API. OLP CLI provides helper tools to facilitate direct calls to the REST API, such as:

For more details, see API Commands.

The following steps show how to combine the functionality of OLP CLI to fetch access token and list of endpoints with direct call to REST API by curl.

Get API Token

To get a new API token, enter the api token get command.

olp api token get --json

The command displays the following results.

{
    "accessToken": "eyJhbG...LMXA",
    "expiresAt": "2019-03-07T10:56:51.329Z"
}

List All API Endpoints

To list all endpoints offered by the HERE platform, use the api list command.

olp api list --json

The command displays the following results:

{"apis": [
    {
        "baseURL": "https://account.api.here.com",
        "api": "account",
        "version": "v1",
        "parameters": {}
    },
    {
        "baseURL": "https://artifact.api.platform.here.com/v1",
        "api": "artifact",
        "version": "v1",
        "parameters": {}
    },
    {
        "baseURL": "https://config.data.api.platform.here.com/config/v1",
        "api": "config",
        "version": "v1",
        "parameters": {}
    },
    {
        "baseURL": "https://api-lookup.data.api.platform.here.com/lookup/v1",
        "api": "lookup",
        "version": "v1",
        "parameters": {}
    },
    {
        "baseURL": "https://marketplace.api.platform.here.com/api/v1",
        "api": "marketplace",
        "version": "v1",
        "parameters": {}
    },
    {
        "baseURL": "https://pipelines.api.platform.here.com/pipeline-service",
        "api": "pipelines",
        "version": "v2",
        "parameters": {}
    }
]}

Call REST API with Curl

To get catalogs to which you have access, execute the following command:

Note

Download and install curl to execute the command below.


curl -k -s -H "Authorization: Bearer eyJhbG...LMXA" https://config.data.api.platform.here.com/config/v1/catalogs

This is equivalent to running the catalog list command.

The command displays results like below:


{
  "results": {
    "items": [
      {
        "title": "Data Validation Library Quick Start Example Comparison Results",
        "hrn": "hrn:here:data:::dvl-example-berlin4-validation-quickstart-scala-comparison",
        "href": "https://config.data.api.platform.here.com/config/v1/catalogs/hrn:here:data:::dvl-example-berlin4-validation-quickstart-scala-comparison",
        "type": "urn:olp-types:catalog"
      },
      {
        "title": "Data Validation Library Quick Start Example Input",
        "hrn": "hrn:here:data:::dvl-example-berlin4-validation-quickstart-input",
        "href": "https://config.data.api.platform.here.com/config/v1/catalogs/hrn:here:data:::dvl-example-berlin4-validation-quickstart-input",
        "type": "urn:olp-types:catalog"
      },
      {
        "title": "Data Validation Library Quick Start Example Metrics Results",
        "hrn": "hrn:here:data:::dvl-example-berlin4-validation-quickstart-java-metrics",
        "href": "https://config.data.api.platform.here.com/config/v1/catalogs/hrn:here:data:::dvl-example-berlin4-validation-quickstart-java-metrics",
        "type": "urn:olp-types:catalog"
      }
    ]
  }
}

For more information about the Data Hub API, see Data Hub API.

Further Reading

results matching ""

    No results matching ""