How to Add Document Deletion feature REST exposition?

May i know the client code for delete a particular file from remote server(nuxeo)through REST API.

Please share your views with me!


0 votes

1 answers



This question comes from

First a little precision about your question. When you talk about File in Nuxeo we talk about binaries (Word file, LibreOffice file, …). The object that stores metadata and optionally file(s) is called Document or Nuxeo Document.

So I think that you would like to remove a Nuxeo Document through a HTTP Call.

You have at least 3 possibilities to do that with Nuxeo.

First through the old Nuxeo REST API:

You just have to do the following GET request:


where c800c2f2-b834-4751-b362-db821d5ce30b is the id of your document

Secondly through the Automation REST API and Automation client library:

import org.nuxeo.ecm.automation.client.adapters.DocumentService;
import org.nuxeo.ecm.automation.client.jaxrs.impl.HttpAutomationClient;
import org.nuxeo.ecm.automation.client.model.Document;
import org.nuxeo.ecm.automation.client.Session;

public static void main(String[] args) throws Exception {
    HttpAutomationClient client = new HttpAutomationClient(

    Session session = client.getSession("Administrator", "Administrator");
    // Fetch the document
    Document doc = (Document) session.newRequest(DocumentService.FetchDocument).set(
                "value", "/path/of/your/document").execute();
    // Delete it


You can put the path (“/path/of/your/document”) like I did here or the id if you want.

Or you create an operation that fetch the document according a given parameter “docRef” and remove it:

  • Fetch > Document (value = @{Context[“docRef”]})
  • Document > Delete

And the call with curl, for instance, will be like that:

curl -H 'Content-Type:application/json+nxrequest' -X POST 
  -d '{"params":{"docRef":"/path/of/your/document"},"context":{}}' 
  -u Administrator:Administrator http://localhost:8080/nuxeo/site/automation/NameOfYouOperation
3 votes