Remove documents, or reset document metadata.
|uri+||The URI of a document to delete or for which to remove metadata. You can specify multiple documents.|
The category of data to remove/reset. Category may be specified
multiple times to remove or reset any combination of content and
metadata. Valid categories: |
|database?||Perform this operation on the named content database instead of the default content database associated with the REST API instance. Using an alternative database requires the "eval-in" privilege; for details, see Security Requirements in the REST Application Developer's Guide.|
The transaction identifier of the multi-statement transaction in
which to service this request. Use the |
|temporal-collection?||Specify the name of a temporal collection that contains the document(s) to be deleted. For details, see Managing Temporal Documents in the Temporal Developer's Guide. Applies to all documents when deleting more than one.|
Set the system start time for the insertion or update. Ignored if
|If-Match?||Not supported when deleting multiple documents. When deleting a single document, this header pecifies a document version identifier that must match the current version of the target document for the delete to succeed. If the current version of the document does not match, a 412 (Precondition Failed) status is returned. A value of 0 indicates the document must not already exist in the database. Ignored unless optimistic locking is enabled; for details see Using Optimistic Locking to Update Documents in the REST Application Developer's Guide.|
Upon success, MarkLogic Server returns status 204 (Document Deleted) or 204 (Metadata Reset).
rest-writerrole, or the following privileges:
Removing content also removes all metadata for the document.
Removing a binary document also removes extracted metadata stored in a separate XHTML document. See Extracting Metadata and Text From Binary Documents in the Search Developer's Guide.
Sending a DELETE request for permissions metadata resets the permissions to the default for the current user.
Sending a DELETE request for quality resets the content quality to the default value (0).
When you specify multiple URIs, the entire request fails if an error occurs for any one document. If a document does not exist, that URI is silently ignored, rather than causing an error. Optimistic locking is not supported when you specify multiple URIs.
For more details, see Removing Documents from the Database in the REST Application Developer's Guide.
curl --anyauth --user user:password -X DELETE -i \ http://localhost:8000/v1/documents?uri=/shakespeare/plays/a_and_c.xml ==> The document with URI /shakespeare/plays/a_and_c.xml is removed. The following headers are returned: Server: MarkLogic Content-Type: text/plain; charset=UTF-8 Content-Length: 31 Connection: close HTTP/1.1 204 Document Deleted Server: MarkLogic Content-Length: 0 Connection: close
curl --anyauth --user user:password -X DELETE -i \ 'http://localhost:8000/v1/documents?uri=foo.xml&uri=bar.xml&category=collections' ==> The collections metadata is reset for the documents foo.xml and bar.xml. The response looks similar to the following: Server: MarkLogic Content-Type: text/plain; charset=UTF-8 Content-Length: 31 Connection: Keep-Alive HTTP/1.1 204 Metadata Reset Server: MarkLogic Content-Length: 0 Connection: Keep-Alive