Call Location Service API

This chapter explains how to construct an HTTP request and use it to call the API of a location service hosted on the HERE platform.

HTTP Request Structure

To construct an HTTP request to a location service API, you need the following:

  • The base URL of the service
  • The OpenAPI specification for the service

Get the Base URL

To obtain the location service's base URL, first look up the service that you need in the HERE Location Service registry by means of one of the available options.

The result includes the base URL of the location service that you can use to construct a request to the endpoint.

Get the OpenAPI Specification

To obtain a location service's OpenAPI specification in the YAML format, you can use the following options:

  • Download the API specification document from the location service's details page in the HERE platform portal (from the API Reference tab).

  • Call the following endpoint and pass the service's HRN:

    curl{service HRN}/openApi \
           -H "Authorization: Bearer <your access token>" \
           -o <path to output file>
    curl{service HRN}/openApi ^
           -H "Authorization: Bearer <your access token>" ^
           -o <path to output file>

Construct a Request

Once you have obtained the base URL and the specification for a location service, you can construct the request for the target endpoint.

Example Call to a Location Service

To show how you can use your access token within your requests to a HERE location service, you can call a sample HERE Location Service Demo service. Use the following command and pass your access token to it to see how it works:

curl \
       -H "Authorization: Bearer <your access token>"
curl ^
       -H "Authorization: Bearer <your access token>"

The following response illustrates a possible result:


Generate a Client Application

You are recommended to create an API client application that you can integrate with your projects. With the OpenAPI Generator, you can create an API client that interacts with a HERE Location Service API. Before you proceed, you need to obtain an OpenAPI specification document for a location service.

OpenAPI Generator supports different integrations, including:

  • Maven
  • Gradle
  • GitHub
  • CLI via Docker
  • and others

For more information on supported integrations, see Workflow Integrations.

Note: OpenAPI specification compatibility

For more information on the openapi-generator compatibilities with the OpenAPI specification, see Compatibility.

For more information on the languages that OpenAPI Generator supports, see the corresponding file on GitHub.

Next Steps

The guidelines in the next chapter walk you through the entire process of generating a sample Java API client application that you can include as a dependency in your projects.

results matching ""

    No results matching ""