As REST is based on the usage of HTTP, so it's very simple to use. You can call a REST service in any languages, with the help of nuxeo-http-client or even in just a simple web browser.
This tutorial aims at presenting the mains REST services usables in Nuxeo, and how to use them to create, update, delete a document or look up in the repository.
Usage
Each service looks for parameters presents in the url, for example:
The url is composed with three parameters which are :
- {repo} : Name of the repository
- {docid} : ID of the document, you can get it from the url when you navigate in nuxeo. Every element in the repository as an ID : Document, Workspace, Section
- {filename} : File name of the file to upload
You need to be log to nuxeo in order to use the REST services via a browser.
The main services
createDocument Service
This service allows to create documents in the repository.
Usage: http://server:port/nuxeo/restAPI/\{repo}/{docid}/createDocument?documentsProperties
example :
Just replace the docid whith the id of a workspace or folder and drop the url in your browser.
You will get this.
As you see, the document as been created.
export
Allow to get a full description of a document.
usage : http://server:port/nuxeo/restAPI/
/
/export
example : http://127.0.0.1:8080/nuxeo/restAPI/default/c800c2f2-b834-4751-b362-db821d5ce30b/export?format=tree
A you see, i look for the document salary that we just created.
opensearch
opensearch allows to make full text research on the repository.
Usage : http://127.0.0.1:8080/nuxeo/restAPI/opensearch?q=salary
Result :
updateDocument
This restlet allows to change simples properties.
It will change our document description to "no comment"
deleteDocument
workflowTasks
workflowTasks allows to export all the tasks in progress.
example : http://127.0.0.1:8080/nuxeo/restAPI/workflowTasks/default/?format=xml