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/nuxeoand 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
idwhich 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 propertiesheader so that you only retrieve thepictureschema. - Get the document using the document's
path(also in the XML/JSON export).
Only theGET /api/v1/path/{docPath}pictureproperties are displayed in theproperties:{}section of the JSON response. Thedublincore,file,commonand other properties are not in the response. - In the Command Endpoint, get the document using the Fetch > Document operation and the
pathoridas 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
idendpoint is recommended over thepathendpoint when possible as it improves performance.