Get data from a versioned layer

You can request any data version from a versioned layer. When you request a particular version of data from the versioned layer, the partition you receive in the response may have a lower version number than you requested. The version of a layer or partition represents the catalog version in which the layer or partition was last updated.

To get data from the versioned layer:

  1. Get an access key ID and access key secret.

    For instructions, see Authenticate to the HERE platform using client credentials.

  2. Create the OlpClientSettings instance.

    For instructions, see Create platform client settings.

  3. Create the VersionedLayerClient object with the HERE Resource Name (HRN) of the catalog that contains the layer, layer ID, platform client settings from step 2, and catalog version.

    Note: If the version is not specified, the latest version is used.

    const versionedLayerClient = new VersionedLayerClient({
      catalogHrn: HRN.fromString("your-catalog-hrn"),
      layerId: "your-layer-id",
      settings: olpClientSettings,
      version: number
    });
    
  4. Create the DataRequest object with the following data:

    • Layer version

      Note: If the version is not specified, the latest version is used. Also, the version specified in the request overrides the version specified in the VersionedLayerClient object. The withVersion parameter in the request will be deprecated in July.

    • Partition ID
    • Fetch option

      The default fetch option is OnlineIfNotFound. It queries the network if the requested resource is not found in the cache. If you want to skip cache lookups and query the network right away, set the withFetchOption method to OnlineOnly.

    const dataRequest = new DataRequest()
      .withVersion("VersionNumber")
      .withPartitionId("PartitionId")
      .withBillingTag("MyBillingTag")
      .withFetchOption(FetchOptions.OnlineOnly);
    
  5. Call the getData method with the DataRequest parameter.

    const partitions = await versionedLayerClient.getData(dataRequest);
    

You receive data from the requested partition of the selected layer version.

For examples, see Run the examples.

In browser and Node.js, to abort requests before they have completed, you can create the AbortController object, and then add the AbortController.signal property to your requests. For more information, see the AbortController documentation.

Example

const abortController = new AbortController();
const partitions = await versionedLayerClient.getData(
  dataRequest,
  abortController.signal
);

results matching ""

    No results matching ""