Using the compressedBinaryDataFileId Property

Use the compressedBinaryDataFileId property when you want to push 256 MB or less of compressed or uncompressed, binary or non-binary item data.

Using this property to push item data involves three distinct steps which are detailed in this article.

Step 1 - Create a File Container

The first thing you need to do is to create an Amazon S3 file container (see Creating a File Container).

Step 2 - Upload the Item Data into the File Container

Next, you need to perform the following PUT request to upload your item data into the Amazon S3 file container you got from Step 1 - Create a File Container).

Request template

PUT <MyUploadURI> HTTP/1.1
 
<HTTPHeaders>
<MyItemData>

Replace:

  • <MyUploadURI> with the uploadUri you got from Step 1 - Create a File Container.
  • <HTTPHeaders> with the requiredHeaders you got from Step 1 - Create a File Container.
  • <MyItemData> with your uncompressed or Deflate, GZip, LZMA, or ZLib compressed item data. Your request body must be in binary format.

    Do not Base64 encode your item data.

Sample Request

Uploading Deflate compressed item data

PUT https://s3.amazonaws.com/coveo-nprod-customerdata/proda/blobstore/mycoveocloudv2organizationg8tp8wu3/05ee7647-15a6-464a-8ffd-cd2fb6c1a03b[...] HTTP/1.1
 
x-amz-server-side-encryption: AES256
Content-Type: application/octet-stream

Payload (binary format)

eJyzySjJzbHjUgACm4zUxBQoUx+JnZSfUglhQlQZ2rlWJOYW5KQCVRkiSRTYhWRkFisAUWKeQipEiZ6NfoEdF6eNPsQQoA6QdQDMhB8E

Successful response - 200 OK

{}

Step 3 - Use the fileId as the CompressedBinaryDataFileId value

Once the request you performed in Step 2 - Upload the Item Data into the File Container has successfully returned, you can use the fileId you got from Step 1 - Create a File Container as the compressedBinaryDataFileId property value.

Using the compressedBinaryDataFileId Property when Pushing a Single Item

The following example shows how you can use the compressedBinaryDataFileId property to specify item data when performing a single push operation (see Adding or Updating a Single Item in a Push Source).

When using the compressedBinaryDataFileId property to push a single item, your query string should include the compressionType parameter along with the compression algorithm that was applied on the data:

  • UNCOMPRESSED
  • DEFLATE
  • GZIP
  • LZMA
  • ZLIB

Those values are case sensitive. The default value is ZLIB.

Sample request

PUT https://api.cloud.coveo.com/push/v1/organizations/mycoveocloudv2organizationg8tp8wu3/sources/mycoveocloudv2organization-rp5rxzbdz753uhndklv2ztkfgy/documents?documentId=file://example.html&compressionType=DEFLATE HTTP/1.1
  
Content-Type: application/json
Accept: application/json
Authorization: Bearer **********-****-****-****-************

Payload

{
  // ...Item metadata...
  "compressedBinaryDataFileId": "b5e8767e-8f0d-4a89-9095-1127915c89c7",
  "fileExtension": ".html",
  // ...Item permission model (if applicable)...
}

Successful response - 202 Accepted

{}

Using the compressedBinaryDataFileId Property when Uploading a Batch of Items

The following example shows how you can use the CompressedBinaryDataFileId property to specify item data when uploading content into a file container before performing a batch push operation (see Managing Batches of Items in a Push Source - Step 2 - Upload the Content Update into the File Container).

When using the compressedBinaryDataFileId property to push the data of an item in a batch, the document body this item should include the compressionType property along with the compression algorithm that was applied on the data:

  • "UNCOMPRESSED"
  • "DEFLATE"
  • "GZIP"
  • "LZMA"
  • "ZLIB"

Those values are case sensitive. The default value is "ZLIB".

Sample request

PUT https://s3.amazonaws.com/coveo-nprod-customerdata/proda/blobstore/mycoveocloudv2organizationg8tp8wu3/b5e8767e-8f0d-4a89-9095-1127915c89c7[...] HTTP/1.1
 
x-amz-server-side-encryption: AES256
Content-Type: application/octet-stream

Payload

{
  "addOrUpdate": [
    {
      // ...Item metadata...
      "documentId": "file://example.html",
      "compressedBinaryDataFileId": "b5e8767e-8f0d-4a89-9095-1127915c89c7",
      "compressionType": "DEFLATE",
      "fileExtension": ".html",
      // ...Item permission model (if applicable)...
    },
    // ...More items to add or update...
  ],
  "delete": [
    // ...Items to delete...
  ]
}

Successful response - 200 OK

{}
Recommended Articles