Delete old items in a Push source
Delete old items in a Push source
You can perform a single Push API request to delete all of the items in a Push source that were last updated with a Push API request whose orderingId is lower than a specified value.
This article provides an overview of the Delete old items request.
Delete old items Push API request (highlighted) as it progresses through the Coveo indexing pipeline.Request template
US East region
DELETE https://api.cloud.coveo.com/push/v1/organizations/<MyOrganizationId>/sources/<MySourceId>/documents/olderthan?orderingId=<MyOrderingId>&queueDelay=<MyQueueDelay> HTTP/1.1
Accept: application/json
Authorization: Bearer <MyAccessToken>
Canada region
DELETE https://api-ca.cloud.coveo.com/push/v1/organizations/<MyOrganizationId>/sources/<MySourceId>/documents/olderthan?orderingId=<MyOrderingId>&queueDelay=<MyQueueDelay> HTTP/1.1
Accept: application/json
Authorization: Bearer <MyAccessToken>
Ireland region
DELETE https://api-eu.cloud.coveo.com/push/v1/organizations/<MyOrganizationId>/sources/<MySourceId>/documents/olderthan?orderingId=<MyOrderingId>&queueDelay=<MyQueueDelay> HTTP/1.1
Accept: application/json
Authorization: Bearer <MyAccessToken>
Australia region
DELETE https://api-au.cloud.coveo.com/push/v1/organizations/<MyOrganizationId>/sources/<MySourceId>/documents/olderthan?orderingId=<MyOrderingId>&queueDelay=<MyQueueDelay> HTTP/1.1
Accept: application/json
Authorization: Bearer <MyAccessToken>
Request parameters:
Parameters
In the request path:
-
Replace
<MyOrganizationId>with your organization ID. -
Replace
<MySourceId>with the ID of the target Push source.
In the query string:
-
Replace
<MyOrderingId>with theorderingIdvalue you want to use. Any item that was pushed by a request whoseorderingIdis lower ("older") than this value will be deleted from the target Push source.Unless you’re setting your own
orderingIdvalues when pushing items, you should typically set theorderingIdof aDelete old itemsrequest to the current number of milliseconds since the Unix epoch, without any offset.For example, let’s say you’re letting the Push API set its own
orderingIdvalues when you push content updates to your source. This means that each content update request you perform on that source has itsorderingIdautomatically set to the current number of milliseconds since the Unix epoch, which is UTC-based.When performing a
Delete old itemsrequest on that source, you retrieve the current Unix timestamp, but then mistakenly adjust it to Central European Standard Time (that is, UTC+1) before setting it as theorderingIdvalue. As a result, the indexing pipeline will reject new pushed items for an hour after you perform the request. -
Optionally, replace
<MyQueueDelay>with the number of minutes you want the Push API to wait before enqueueing theDelete old itemsoperation in the indexing pipeline.The default
queueDelayvalue is15(minutes).This grace period is intended to give the indexing pipeline enough time to finish processing any previously enqueued operations that would affect the target Push source.
Performing a
Delete old itemsrequest with a lowqueueDelayvalue may have unexpected results (that is, some items you expect to be deleted could be added back into the target Push source after the request is processed).
In the Authorization HTTP header:
-
Replace
<MyAccessToken>with a Push source API key that grants the set of privileges required to push items to your source.
Request body: None
Successful response: 202 Accepted
A successful response (202 Accepted) has no content, but it indicates that the operation was forwarded to the service.
It will be enqueued to be processed by the indexing pipeline when the specified (or default) queueDelay has elapsed.
This doesn’t imply that the items were successfully deleted in the target Push source.
See About the Push API processing delay for details.
|
|
Leading practice: Update the status of your Push source
If you set your Push source to an active status before, and you have no further requests to perform as part of this content update, you should consider setting it back to the |
Sample request
The following example shows how to delete all items older than a specified orderingId value.
DELETE https://api.cloud.coveo.com/push/v1/organizations/mycoveocloudv2organizationg8tp8wu3/sources/mycoveocloudv2organization-rp5rxzbdz753uhndklv2ztkfgy/documents/olderthan?orderingId=1509711177594&queueDelay=1 HTTP/1.1
Accept: application/json
Authorization: Bearer **********-****-****-****-************