Remove documents, or reset document metadata.
URL Parameters | |
---|---|
uri+ | The URI of a document to delete or for which to remove metadata. You can specify multiple documents. |
category* |
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: content (default),
metadata , metadata-values ,
collections , permissions ,
properties , and quality .
Use metadata to reset all metadata.
See the Usage notes below.
|
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. |
txid? |
The transaction identifier of the multi-statement transaction in
which to service this request. Use the /transactions
service to create and manage multi-statement transactions.
|
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. |
system-time? |
Set the system start time for the insertion or update. This time will
override the system time set by MarkLogic. Ignored if
temporal-collection is not included in the request.
Applies to all documents when deleting more than one.
|
result=wiped? |
Remove all versions of a temporal document rather than performing
a temporal delete. You can only use this parameter when you also
specify a temporal-collection parameter. You must
have appropriate privileges to wipe a temporal document. For more
details, see temporal:document-wipe.
|
Request Headers | |
---|---|
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-writer
role, or the
following privileges:
http://marklogic.com/xdmp/privileges/rest-writer
http://marklogic.com/xdmp/privileges/rest-reader
Using the system-time
parameter also requires the
following privilege:
http://marklogic.com/xdmp/privileges/temporal-statement-set-system-time
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).
The metadata-values
category represents "metadata fields"
document metadata. For more details, see
Metadata Fields in the Administrator's Guide.
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.
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
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.