Loading TOC...

DELETE /v1/documents

Summary

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, 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. Ignored if temporal-collection is not included in the request. Applies to all documents when deleting more than one.
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.

Response

Upon success, MarkLogic Server returns status 204 (Document Deleted) or 204 (Metadata Reset).

Required Privileges

This operation requires the rest-writer role, or the following privileges:

http://marklogic.com/xdmp/privileges/rest-writer

http://marklogic.com/xdmp/privileges/rest-reader

Usage Notes

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.

Example

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
  

Example

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
  

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy