Creating a Document using Nuxeo Platform UI
- Log into your Nuxeo instance.
- Go to
default-domain/workspaces
. - Create a Workspace named "Rest API Tutorial".
- Create a Picture document within the Workspace.
- Export the Document using the XML export option in Nuxeo Platform or by clicking the link in the Nuxeo Dev Tools extension.
These exports show you the properties of the document. The
<document id>
and<path>
properties will be used in next section.
Retrieving the Document using the REST API
- Log into the API Playground using your Nuxeo Server URL,
http://NUXEO_SERVER/nuxeo
and your credentials, or simply click the API Playground button in the Nuxeo Dev Tools extension. - In the Resources Endpoints, get the document using the document's
id
which can be found in the XML/JSON export obtained earlier.
The full JSON definition of the documentation is displayed in the Response tab.GET /api/v1/id/{docId}
- Click on the Settings icon to change the
properties
header so that you only retrieve thepicture
schema. - Get the document using the document's
path
(also in the XML/JSON export).
Only theGET /api/v1/path/{docPath}
picture
properties are displayed in theproperties:{}
section of the JSON response. Thedublincore
,file
,common
and other properties are not in the response. - In the Command Endpoint, get the document using the Fetch > Document operation and the
path
orid
as a parameter.POST /api/automation/Repository.GetDocument
What's the Best Way to Retrieve a Document?
- Using the Resources Endpoints is preferable. The Command Endpoints are better suited when you want to execute business logic.
- Using the
id
endpoint is recommended over thepath
endpoint when possible as it improves performance.