Adding or Updating a Single Basic Item in a Shared Push Source

One of the most rudimentary operations you can perform with the Push API is to add or update a single, uncompressed, 5 MB or less, raw textual item in a shared Push source.

This introductory topic does not delve into more intricate subjects, such as pushing metadata (see Understanding Push Source Item Metadata), permission models (see Simple Permission Model Definition Examples and Complex Permission Model Definition Example), or compressed binary data (see Using the compressedBinaryData Property and Using the compressedBinaryDataFileId Property).

For more generic and advanced use cases, see Adding or Updating a Single Item in a Push Source.

Use the Add or update an item operation to push a small item along with its raw textual data in a shared Push source.

You should never use this operation repetitively to add or update a large number of items in a Push source (i.e., to perform a large scale content update). When that is what you need to do, you should use the batch operation instead (see Managing Batches of Items in a Push Source).

Request template

PUT https://push.cloud.coveo.com/v1/organizations/<MyOrganizationId>/sources/<MyPushSourceId>/documents?documentId=<MyItemURI> HTTP/1.1
 
Content-Type: application/json
Accept: application/json
Authorization: Bearer <MyAccessToken>

Payload

{
  "data": <MyItemData>
}

In the request path:

In the query string:

  • Replace <MyItemURI> with the URL-encoded URI of the public item to add or update in the target shared Push source (e.g., file%3A%2F%2Ffolder%2FdummyItem.html).

In the Authorization HTTP header:

In the request body:

  • Replace <MyItemData> with the raw textual data corresponding to the public item to add or update in the target shared Push source (e.g., "This is a sample raw textual \"Data\" string.").

    • Your total request body size must not exceed 6 MB (see Push API Limits - Request Size Limits).
    • You must properly escape reserved JSON characters (e.g., newline, tab, double quote, backslash, etc.) in your Data string (see [Using the data Property(/en/31/)]).

A successful response (202 Accepted) has no content, but indicates that the operation was successfully forwarded to the service and that the item is now enqueued to be processed by the document processing manager.

This does not imply that the item was successfully added or updated in the target Push source (see Understanding the Push API Processing Delay).

Sample Request

Pushing an item whose raw textual data is HTML formatted

PUT https://push.cloud.coveo.com/v1/organizations/mycoveocloudv2organizationg8tp8wu3/sources/mycoveocloudv2organizationg8tp8wu3-rp5rxzbdz753uhndklv2ztkfgy/documents?documentId=file%3A%2F%2Ffolder%2FdummyItem.html HTTP/1.1
 
Content-Type: application/json
Accept: application/json
Authorization: Bearer **********-****-****-****-************

Payload

{
  "data": "<html><body><h1>Dummy item</h1><p>This is dummy raw textual item data</p></body></html>"
}

Successful response - 202 Accepted

null