Adding or Updating a Single Basic Item in a Public Push Source
Adding or Updating a Single Basic Item in a Public 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 public Push source.
This introductory article doesn’t delve into more intricate subjects, such as pushing metadata (see About 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 Add or Update a Single Item in a Push Source.
Use the PUT /sources/{sourceId}/documents
HTTP request to push a small item along with its raw textual data in a public Push source.
You should never use this operation repetitively to add or update many items in a Push source (that is, to perform a large scale content update). When that’s what you need to do, you should use the batch operation instead (see Manage batches of items in a Push source).
Request template
PUT https://api.cloud.coveo.com/push/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:
- Replace
<MyOrganizationId>
with the ID of the target Coveo organization (see Retrieving the ID of a Coveo Organization). - Replace
<MySourceId>
with the ID of the target public Push source (see Create a Push Source).
In the query string:
- Replace
<MyItemURI>
with the URL-encoded URI of the public item to add or update in the target public Push source (for example,file%3A%2F%2Ffolder%2FdummyItem.html
).
In the Authorization
HTTP header:
- Replace
<MyAccessToken>
with an access token that grants the Sources - Edit privilege on the target source (see Create an API key, Get the privileges of an access token, and Get your Coveo access token).
In the request body:
-
Replace
<MyItemData>
with the raw textual data corresponding to the public item to add or update in the target public Push source (for example,"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 (for example, newline, tab, double quote, backslash, etc.) in your Data string (see Using the data Property).
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 (DPM).
This doesn’t imply that the item was successfully added or updated in the target Push source (see About the Push API Processing Delay).
Sample Request
Pushing an item whose raw textual data is HTML formatted
PUT https://api.cloud.coveo.com/push/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