REST API

Document Resources Endpoints

Updated: July 17, 2023

We provide some sample usages of the REST API. You can also have a try of the REST API on the Nuxeo Platform API Playground.

id Endpoint

PathEndpoint
GET /api/v1/id/{idOfTheDoc} Finds a document by its id
PUT /api/v1/id/{idOfTheDoc} Updates a document by its id
POST /api/v1/id/{idOfTheDoc} Updates a document by its id
DELETE /api/v1/id/{idOfTheDoc} Deletes a document by its id
GET /api/v1/repo/{repoId}/id/{docId} Find a document by its id in a specific repository
PUT /api/v1/repo/{repoId}/id/{docId} Updates a document by its id in a specific repository
POST /api/v1/repo/{repoId}/id/{docId} Updates a document by its id in a specific repository
DELETE /api/v1/repo/{repoId}/id/{docId} Deletes a document by its id in a specific repository

Properties

Beside the docId and repoId parameters, the id endpoint accepts the definition of a document object. See the page REST API Entity Types and the examples below.

Updating a Document

To update a document you have to PUT on the document resource, and pass a reduced version of the entity type content as the data. You can also pass the full set of data, but it is not mandatory.

PUT Request

    PUT /nuxeo/site/api/v1/id/{idOfTheDoc}
    {
        "entity-type": "document",
        "repository": "default",
        "uid": "37b1502b-26ff-430f-9f20-4bd0d803191e",
        "properties": {
            "dc:title": "The new title",
            "dc:description": "Updated via a so cool and simple REST API"
            "common:icon": "/icons/file.gif",
            "common:icon-expanded": null,
            "common:size": null
        }
    }

Creating a Document

To create a new document under the current resource, you have to send a POST request with the following data:

POST /nuxeo/site/api/v1/id/{idOfParentDoc}
{
    "entity-type": "document",
    "name":"newDoc",
    "type": "File",
    "properties": {
        "dc:title": "The new document",
        "dc:description": "Created via a so cool and simple REST API"
        "common:icon": "/icons/file.gif",
        "common:icon-expanded": null,
        "common:size": null
    }
}

In this case, the id of the document is the parent document's id, and the name property in the entity stands for the name of the newly created document. You don't have to specify a UID since the session will create one for you. It will be returned in the response.

Deleting a Document

DELETE /nuxeo/site/api/v1/id/{idOfTheDoc}

Path Endpoint

PathEndpoint
GET /api/v1/path/{docPath} Finds a document by its path
PUT /api/v1/path/{docPath} Updates a document by its path
DELETE /api/v1/path/{docPath} Deletes a document by its path
POST /api/v1/path/{docPath} Creates a document by its parent path
GET /api/v1/repo/{repoId}/path/{docPath} Finds a document in a specific repository by its path
PUT /api/v1/repo/{repoId}/path/{docPath} Updates a document in a specific repository by its path
DELETE /api/v1/repo/{repoId}/path/{docPath} Deletes a document in a specific repository by its path
POST /api/v1/repo/{repoId}/path/{docPath} Creates a document in a specific repository by its parent path

Properties

The path endpoint does not requires parameters besides the docPath and repoId parameters. It can however leverage web adapters such as @children, @search, @bo. See the examples on the page Web Adapters for the REST API.