Deleting an Item and Optionally, its Children in a Push Source
Deleting an Item and Optionally, its Children in a Push Source
Being able to delete a single item in a Push source, possibly along with its children, can especially useful when you’re testing the service or when you need to perform a very small content update.
Use the Delete an item and optionally its children operation to remove an item from a specific Push source.
You should never use this operation repetitively to delete many items in a Push source (that is, to perform a large scale content update). When this is what you need to do, depending on what you want to achieve, you should either use:
- The batch operation (see Manage batches of items in a Push source).
- The delete older than operation (see Deleting Old Items in a Push Source).
Request template
DELETE https://api.cloud.coveo.com/push/v1/organizations/<MyOrganizationId>/sources/<MySourceId>/documents?deleteChildren=<true|false>&documentId=<MyItemURI> HTTP/1.1
Authorization: Bearer <MyAccessToken>
In the request path:
-
Replace
<MyOrganizationId>
with the actual ID of the target Coveo organization (see Retrieve the organization ID). -
Replace
<MySourceId>
with the actual ID of the target Push source (see Create a Push Source).
In the query string:
-
Set
deleteChildren
totrue
if you want to recursively delete all items matching the<MyItemURI>
+/
; set it tofalse
otherwise.This means that the following request:
DELETE https://api.cloud.coveo.com/push/v1/organizations/mycoveocloudv2organizationg8tp8wu3/sources/mycoveocloudv2organizationg8tp8wu3-rp5rxzbdz753uhndklv2ztkfgy/documents?deleteChildren=true&documentId=file%3A%2F%2Ffolder HTTP/1.1 Authorization: Bearer **********-****-****-****-************
will recursively delete all items whose
documentId
matchesfile://folder/*
from the target Push source (for example,file://folder/file1.txt
,file://folder/subfolder/file2.txt
, etc.). -
Replace
<MyItemURI>
with the URL-encoded URI of the item to delete in the target 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).
A successful response (202 Accepted
) indicates that the delete operation was successfully forwarded to the service and is now enqueued to be processed in the Coveo indexing pipeline.
This doesn’t imply that the item was successfully deleted in the target Push source (see About the Push API Processing Delay).
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 IDLE
status once this operation has successfully returned, assuming you have no more operations to perform as part of this content update (see Updating the Status of a Push Source).
Sample Request
Deleting an item and its children
DELETE https://api.cloud.coveo.com/push/v1/organizations/mycoveocloudv2organizationg8tp8wu3/sources/mycoveocloudv2organizationg8tp8wu3-rp5rxzbdz753uhndklv2ztkfgy/documents?deleteChildren=true&documentId=file%3A%2F%2Ffolder%2F HTTP/1.1
Authorization: Bearer **********-****-****-****-************
Successful response - 202 Accepted
null