Hi all,
I have managed to create a folder document and a file document into NUXEO via REST API. The code that works is accessible in this post (http://community.bonitasoft.com/groups/french-corner/cmis). Here the code :
import org.nuxeo.ecm.automation.client.jaxrs.impl.HttpAutomationClient; import org.nuxeo.ecm.automation.client.OperationRequest; import org.nuxeo.ecm.automation.client.Session; import org.nuxeo.ecm.automation.client.adapters.DocumentService; import org.nuxeo.ecm.automation.client.model.Document; import org.nuxeo.ecm.automation.client.model.PropertyMap;String url = “http://localhost:8080/nuxeo/site/automation”;
HttpAutomationClient client = new HttpAutomationClient(url);
Session session = client.getSession(“Administrator”, “Administrator”);
Document root = null;
// Get The Root
try {
root = (Document) session.newRequest(“Document.Fetch”).set( “value”, “/default-domain/”).execute();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// Create a File Document
try {
OperationRequest request = session.newRequest(“Document.Create”);
request.setInput(root);
request.set(“type”, “File”);
request.set(“name”, “Name”);
request.set(“properties”, “dc:title=Title”);
request.execute();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
How can I do this? If you have an example or a piece of code, I’m interested.
Thanks,
Jean-Marie