Get Data from a Versioned Layer

You can get data from a versioned layer using the REST APIs metadata (for metadata) and blob (for data).

The typical flow for getting data consists of the following steps.

  1. Obtain an authorization token
  2. Get API base URLs
  3. Get the data handle
  4. Get partition data

Obtain an Authorization Token

Obtain an authorization token for your HTTP requests. For instructions, see the Authentication and Authorization Developer's Guide.

Get API Base URLs

Use the API Lookup service to get the API endpoints for the metadata and blob APIs for the catalog you want to get data from. For instructions, see the API Lookup Developer's Guide.

Get the Data Handle

In order to get data from the blob API, you must obtain the data handle of the partition that contains the data you want. To get the data handle, use the metadata API.

GET /<Base path for the metadata API from the API Lookup Service>/layers/<Layer ID>/partitions?version=<Catalog Version> HTTP/1.1
Host: <Hostname for the metadata API from the API Lookup Service>
Authorization: Bearer <Authorization Token>
Content-Type: application/json
Cache-Control: no-cache

The response contains an array of partition metadata. For example:

{
  "partitions": [
    {
      "checksum": "b45cffe084dd3d20d928bee85e7b0f21",
      "compressedDataSize": 1024,
      "dataHandle": "1b2ca68f-d4a0-4379-8120-cd025640510c",
      "dataSize": 0,
      "layer": "my-layer",
      "partition": "314010583",
      "partitionType": "reference",
      "version": 0
    }
  ]
}

Get Partition Data

Now that you have the partition metadata, search it to find the data handle for the partitions you want. Then, use the data handle to retrieve data using the blob API:

GET /<Base path for the blob API from the API Lookup Service>/layers/<Layer ID>/data/<Data Handle> HTTP/1.1
Host: <Hostname for the blob API from the API Lookup Service>
Authorization: Bearer <Authorization Token>
Cache-Control: no-cache

The response consists of the binary data that was uploaded most recently to the given data handle.

Note

We recommend that your application includes retry logic for handling HTTP 5xx errors. Use exponential backoff in the retry logic.

results matching ""

    No results matching ""