How to get data from a versioned layer
You can request any version of data 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:
-
Create the
VersionedLayerClientobject. -
Create the
DataRequestobject with the partition ID and fetch option. The default fetch option isOnlineIfNotFound. 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 toOnlineOnly.const dataRequest = new DataRequest() .withPartitionId("PartitionId") .withBillingTag("MyBillingTag") .withFetchOption(FetchOptions.OnlineOnly); -
Call the
getDatamethod with theDataRequestparameter.const partitions = await versionedLayerClient.getData(dataRequest);
You receive data from the requested partition of the selected layer version.
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
);Updated 9 days ago