Using the data Property

You should only use the data property when you want to push 5 MB or less of raw textual item data.

In spite of its limited flexibility, this property is very convenient when performing simple Push API tests, due to its inherent simplicity.

Ensure that you properly escape reserved JSON characters (newline, tab, double quote, backslash, etc.) in your data string.

Using the data Property when Pushing a Single Item

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

Sample request

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

Payload

{
  // ...Item metadata...
  "data": "<html><head></head><body><h1>Example</h1><p>This is an \"example\".</p></body></html>",
  "fileExtension": ".html",
  // ...Item permission model (if applicable)...
}

Successful response - 202 Accepted

{}

Using the data Property when Uploading a Batch of Items

The following example shows how you can use the data 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).

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",
      "data": "<html><head></head><body><h1>Example</h1><p>This is an \"example\".</p></body></html>",
      "fileExtension": ".html",
      // ...Item permission model (if applicable)...
    },
    // ...More items to add or update...
  ],
  "delete": [
    // ...Items to delete...
  ]
}

Successful response - 200 OK

{}
Recommended Articles