Get External Service Data

As a Marketplace consumer, you can perform an HTTP request to an external service (ExtSvc) such as REST API or AWS S3 bucket using Marketplace External Proxy Service (Marketplace EPS). The request will be authenticated, processed, recorded through Technical Account for billing, and redirected to an external service. You will receive a response from an external service in its original form, with the same HTTP response code and the same response header as if you would call the external service directly. If an external service fails with an error, you will receive this error in its original form.

Request an External REST API

To post a successful call to Marketplace EPS tunnel, perform a REST API call in the following format:

https://p.hereapi.com/tunnel/{domain}/{pathToExternalServiceResource}?{optionalRequestParameters}
  • p.hereapi.com - Base URL
  • {domain} - ExtSvc domain (identifier) to forward an HTTP request to
  • {pathToExternalServiceResource} - ExtSvc resource path to combine with the domain
  • {optionalRequestParameters} - Any request parameters required by an ExtSvc resource

A typical proxy tunnel workflow includes the following steps:

  1. Post a request to an external REST API using the format provided above. For example, https://p.hereapi.com/tunnel/dataservice.company-name.com/locations/v1/topcities/50. Use the HERE account credentials for this call.

    Find the domain and resource path for the request in an API endpoint example on the subscription details page:

    External REST API data subscription in HERE Marketplace
    Figure 1. External REST API data subscription in HERE Marketplace

    In case there is an asterisk (wildcard) at the end of the resource path, you may add further path details after a slash. You shouldn't put an asterisk in your request URL, though.

    For information on possible resource path modifications and optional request parameters, see information by the service provider in the corresponding subscription.

  2. Marketplace EPS authenticates you and inspects the dataservice.company-name.com part, also known as a service provider domain, to validate this previously provisioned domain.

  3. Marketplace EPS inspects the locations/v1/topcities/50 part, also known as a service provider resource, and checks if you have access to this resource in the specified domain. If you don't have access, the service returns an error. If you have access, step 4 follows.
  4. Marketplace EPS combines the domain and path and prepares to execute the request https://dataservice.company-name.com/locations/v1/topcities50. At the same time, Marketplace EPS extracts the Marketplace provider's API key stored in a database and appends it to the request (in the case of simple API key-based authentication). For example, if a previously provisioned API key is ABCDEFGH, the resulting request will be https://dataservice.company-name.com/locations/v1/topcities/50?api_key=ABCDEFGH.
  5. The request is performed and the response is read.
  6. The response is recorded and submitted to Technical Account to perform proper billing and analytics. This is a background operation and does not affect the call latency.
  7. The response is forwarded back to you with the original payload and HTTP headers. In case of failure, an HTTP response code with an error payload is returned.

Request an External AWS S3 Bucket

As a Marketplace consumer, you can request external resources stored as cloud objects in Amazon (AWS) S3 buckets through Marketplace External Proxy Service. Make requests to the entire bucket or its specific directory using the following formats, respectively:

Entire bucket resources
Specific bucket directory resources
GET https://p.hereapi.com/aws/s3/buckets/{bucketName}/resources
GET https://p.hereapi.com/aws/s3/buckets/{bucketName}/resources?path={somePath}
  • p.hereapi.com - Base URL
  • {bucketName} - S3 bucket name (identifier)
  • {somePath} - Resource path:
    • dir_1/
    • dir_1/sub_dir_1/

A typical AWS S3 proxy workflow includes the following steps:

  1. Post a request to an external AWS S3 bucket using the format provided above. For example, https://p.hereapi.com/aws/s3/buckets/s3extproxytest/resources?path=dir_1/. Use the HERE account credentials for this call.

    Find the S3 bucket name and resource path for the request in an API endpoint example on the subscription details page:

    External AWS S3 data subscription in HERE Marketplace
    Figure 2. External AWS S3 data subscription in HERE Marketplace

    In case there is an asterisk (wildcard) at the end of the resource path, you may add further path details after a slash. You shouldn't put an asterisk in your request URL, though.

    For information on possible resource path modifications, see information by the service provider in the corresponding subscription.

  2. You get a response with a list of objects to download.

    Response example:

    Status code 200
    

    Body:

    Entire bucket resources
    Specific bucket directory resources
    {
              "pageId": 0,
              "nextPageId": 0,
              "isNextPage": false,
              "objectsCount": 1,
              "subDirectories": [
              {
                  "key": "dir_1/",
                  "directoryApiUrl": "/aws/s3/buckets/s3extproxytest/resources?path=dir_1/"
              },
              {
                  "key": "dir_2/",
                  "directoryApiUrl": "/aws/s3/buckets/s3extproxytest/resources?path=dir_2/"
              },
              {
                  "key": "dir_3/",
                  "directoryApiUrl": "/aws/s3/buckets/s3extproxytest/resources?path=dir_3/"
              },
              {
                  "key": "dir_4/",
                  "directoryApiUrl": "/aws/s3/buckets/s3extproxytest/resources?path=dir_4/"
              },
              {
                  "key": "dir_5/",
                  "directoryApiUrl": "/aws/s3/buckets/s3extproxytest/resources?path=dir_5/"
              }
              ],
              "directoryContent": [
          {
              "bucketName": "s3extproxytest",
              "key": "TEST",
              "resourceApiUrl": "/aws/s3/buckets/s3extproxytest/resources/object?path=TEST",
              "size": 57,
              "lastModified": "2021-02-25T17:05:40.000+00:00"
          }
              ]
          }
    {
              "pageId": 0,
              "nextPageId": 0,
              "isNextPage": false,
              "objectsCount": 3,
              "subDirectories": [],
              "directoryContent": [
              {
                  "bucketName": "s3extproxytest",
                  "key": "dir_1/subdir_1/",
                  "resourceApiUrl": "/aws/s3/buckets/s3extproxytest/resources/object?path=dir_1/subdir_1/",
                  "size": 0,
                  "lastModified": "2021-03-01T16:08:22.000+00:00"
              },
              {
                  "bucketName": "s3extproxytest",
                  "key": "dir_1/subdir_1/4b2f59aba8df97645b850b267154f7131bdbcfdb.jpg",
                  "resourceApiUrl": "/aws/s3/buckets/s3extproxytest/resources/object?path=dir_1/subdir_1/4b2f59aba8df97645b850b267154f7131bdbcfdb.jpg",
                  "size": 1636891,
                  "lastModified": "2021-03-01T16:08:52.000+00:00"
              },
              {
                  "bucketName": "s3extproxytest",
                  "key": "dir_1/subdir_1/6ea6e3dcfeae9fbdf2f4999fd61b4ca35740630e.jpg",
                  "resourceApiUrl": "/aws/s3/buckets/s3extproxytest/resources/object?path=dir_1/subdir_1/6ea6e3dcfeae9fbdf2f4999fd61b4ca35740630e.jpg",
                  "size": 172504,
                  "lastModified": "2021-03-01T16:08:53.000+00:00"
              }
              ]
          }
    • resourceApiUrl - List of objects (files) in the current directory to download
  3. Request an object to download by indicating the object URL provided in the list of objects of the resources request. Use the following format:

    p.hereapi.com/aws/s3/buckets/s3extproxytest/resources/object?path={somePath}
    
  4. You get a pre-signed URL to download the object.

    Response example:

    Status code 200
    

    Body:

    https://s3extproxytest.s3.eu-central-1.amazonaws.com/dir_1/?x-consumer-id=null&  X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20210603T125418Z&X-Amz-SignedHeaders=host&  X-Amz-Expires=3599&  X-Amz-Credential=AKIAXGEF5U6TPFKR4FEI%2F20210603%2Feu-central-1%2Fs3%2Faws4_request&  X-Amz-Signature=46e3ba3f84a1d4628fd7fa987e935250263fdd2e410ad70f805115430bcc5d13
    

    Alternatively to requesting a pre-signed URL to download an object, you may request temporary security credentials to make requests for AWS resources using the AWS CLI or AWS API. Use the following format:

    GET https://p.hereapi.com//aws/s3/buckets/{bucketName}/credentials
    

    Response example:

       {
           "accessKeyId": "ASIAXGEF5U6TGQBTBEG3",
           "secretAccessKey": "Aweqo1WiZc8q5z4qTFtgSwnAkf1bltaE8/TI+ypy",
           "sessionToken": "FwoGZXIvYXdzEFgaDPmnt1gHSnE7jTR+EiKfAhnqCapu+Eu0nBK3+7oH2ycukTl5x47pOd1IRrM0qAVjLhzXV0DoW0wseD22C12Ce/       Bs6tApl9nLuuCcoOqL75lZKc7lmiojFxTKeTIn8SjCXCjxmJYrlFLCk6m0VcqfkW0ERzgyY0pmEsH2Ry2+oPEoxjbBLlZQS3T7ghKpzwuQW5GJfLAs2RSR/       9n3PZnOXyz9a6uWEmiCwAqXNEqiTKOEkfW0/+Fm1RBOtCN7+r+nmL+1S15JfNaM/PYYOTR9inxO0j4cCqJaxVsm2WOSSBktolexYXPdsvDnrP9/WXKTUP/nSwb+ilr6ZIAhSvA8GuMD2IMgjXUBuVVWFf4fIHMcCYld4SYYJYcQua/AHCxuI6XutQsQePw29i8ZokxQKNa8jIcGMin8dq00FYwK5kqjTc5tjP5sS8NykwkTEN4zq0Azd9wn2NsclzMGRutkww==",
           "expiresInSeconds": 3600
       }
    
  5. If you use the wrong credentials or haven't subscribed to the requested resources, you get an unsuccessful response with an error description.

    Response example in case of a wrong authorization token:

    Status code 401
    

    Body:

       {
           "error": "Unauthorized",
           "error_description": "Token Validation Failure - Unable to verify signature segment"
       }
    

    Response example in case you don't have permission to access resources:

    Status code 403
    

    Body:

       {
           "title": "Error accessing extsvc resource",
           "code": "E504014",
           "errorCause": "User {userId} does not have readResource permissions on extsvc resource   hrn:here-dev:extsvc::{​​​realm}​​​:{bucketName}-​​​{somePath}​​​",
           "action": "Verify user has policy/permissions granted via ExtSvc Marketplace   subscriptions",
           "errorTag": "extsvc_resource_forbidden"
       }
    

results matching ""

    No results matching ""