Add or update a single item in a Push source
Add or update a single item in a Push source
Being able to add or update a single item in a Push source can be useful when you’re testing the service or when you need to perform a small content update.
This article provides an overview of the PUT /sources/{sourceId}/documents
HTTP request, with details and examples for basic and more complex cases.
PUT /sources/{sourceId}/documents
Push API request (highlighted) as it progresses through the Coveo indexing pipeline.Add or update a basic public item
One of the most rudimentary operations you can perform with the Push API is to add or update a single, uncompressed, raw textual item in a public Push source.
Refer to the following PUT /sources/{sourceId}/documents
HTTP request template and sample to add an item to your public Push source.
Request template
Request definition
ParametersIn the request path:
In the query string:
In the
|
Request body
ParametersReplace 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 |
Successful response - 202 Accepted
A successful response 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). |
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). |
Sample request
The following example shows how to push an item whose raw textual data is HTML formatted.
Request definition
|
Request body
|
Successful response - 202 Accepted
|
Add or update a complex secured item
Assuming that you’ve created a secured Push source, along with a security identity provider for your secured Push source, you can then use the Push API to add a raw text item with access permissions to your source.
Leading practice: Perform a security identity update
Whenever you’re about to add or update content in a secured Push source, you should perform a security identity update on the security identity provider to ensure that the security identities referenced in item permission models are up to date in the security identity cache (see Manage security identities in a security identity provider). |
Refer to the following PUT /sources/{sourceId}/documents
HTTP request template and sample to add a secured item with some metadata to your public Push source.
Request template
Request definition
ParametersIn the request path:
In the query string:
In the
|
Request body
Parameters
See Item models - DocumentBody for the complete list of properties you can include in the request body. |
Successful Response - 202 Accepted
A successful response 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). |
Leading practice: Update the status of your Push source
If you set your Push source to an active status before, you should consider setting it back to the |
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 this is what you need to do, you should use the batch operation instead (see Manage batches of items in a Push source). |
Sample request
The following example shows how to push a secured item whose data was previously uploaded to a file container.
Request definition
|
Request body
|
Successful Response - 202 Accepted
|