Tutorials

REST API Principles

Updated: March 18, 2024

Creating a Document using Nuxeo Platform UI

  1. Log into your Nuxeo instance.
  2. Go to default-domain/workspaces.
  3. Create a Workspace named "Rest API Tutorial".
  4. Create a Picture document within the Workspace.
  5. 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

  1. 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.
  2. In the Resources Endpoints, get the document using the document's id which can be found in the XML/JSON export obtained earlier.
    GET /api/v1/id/{docId}
    
    The full JSON definition of the documentation is displayed in the Response tab.
  3. Click on the Settings icon to change the properties header so that you only retrieve the picture schema.
  4. Get the document using the document's path (also in the XML/JSON export).
    GET /api/v1/path/{docPath}
    
    Only the picture properties are displayed in the properties:{} section of the JSON response. The dublincore, file, common and other properties are not in the response.
  5. In the Command Endpoint, get the document using the Fetch > Document operation and the path or id 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 the path endpoint when possible as it improves performance.