GuidesTypeScript API ReferencePython v2 API Reference
Guides

How to publish data to an object store layer

You can publish data to an object store layer by referencing its key. For data of up to 192 MB, use the single part upload method. If you want to upload larger amounts of data, use the multipart upload method.

When you publish new data, old data is overwritten.

Publish data using the single part upload method

  1. Create the RequestBuilder object.
  2. Call the putBlobByKey function with the layer ID and data key, data length, and content type.
const result = await ObjectStoreApi.putBlobByKey(requestBuilder, {
   layerId: "your-layer-id",
   key: "your-data-key",
   contentLength: data.length,
   body: data
});

You receive a response from the datastore with the status of the operation.

Publish data using the multipart upload method

  1. Make sure you created the OlpClientSettings object.

For instructions, see Create platform client settings.

  1. Initialize the MultiPartUploadWrapper class with the version of the Blob API, catalog HRN, content type, data handle, and layer ID.
  const wrapper = new MultiPartUploadWrapper(
    {
      blobVersion: "v2",
      catalogHrn: "your-catalog-HRN",
      contentType: "your-content-type",
      handle: "your-data-key",
      layerId: "your-layer-id",
    },
    settings
  );
  1. To upload the data, call the upload method with one of the following values:
  • For browsers: File | Blob | ArrayBufferLike.
  • For Node.js: string (the path of the file) | ArrayBufferLike.
await wrapper.upload("your data");

You receive a response from the datastore with the status of the operation.

To practice uploading large amounts of data and learn how to upload it to the Blob API v1, see the MultiPartUploadWrapper example.

Delete data from an object store layer

You can delete data from any object store layer using its key.

To delete data from the object store layer:

  1. Create the RequestBuilder object.
  2. Call the deleteBlobByKey function with the key of the data that you want to delete and layer ID.
const result = await ObjectStoreApi.deleteBlobByKey(requestBuilder, {
   layerId: "your-layer-id",
   key: "your-data-key"
});

You receive a response from the datastore with the status of the operation.

For more information, see the Data API Developer Guide and Data API Blob v2 API Reference.