Here are some examples of the id and Path endpoints.
id Endpoint
Path | Description |
---|---|
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} |
Creates a document by its parent 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
In addition to 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.
Path Endpoint
Path | Endpoint |
---|---|
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 only takes the docPath
and repoId
parameters. It can however be leveraged with web adapters such as @children
, @search
, @bo
. See REST API Web Adapters for more detailed information.
Examples
Creating a Document
To create a new document under the current resource, send a POST request with the following data:
POST http://NUXEO_SERVER/nuxeo/api/v1/id/{idOfParentDoc}
{
"entity-type": "document",
"name":"newDoc",
"type": "File",
"properties": {
"dc:title": "The new document",
"dc:description": "Created via a very cool and easy 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 need to specify a UID since the session will create one for you. It will be returned in the response.
Updating a Document
To update a document, use PUT on the document resource and pass a reduced version of the entity type content as data. You could pass the full set of data but it's not mandatory.
PUT http://NUXEO_SERVER/nuxeo/api/v1/id/{idOfTheDoc}
{
"entity-type": "document",
"uid": "37b1502b-26ff-430f-9f20-4bd0d803191e",
"properties": {
"dc:title": "The new title",
"dc:description": "Updated via a very cool and easy REST API",
"common:icon": "/icons/file.gif",
"common:icon-expanded": null,
"common:size": null
}
}
The uid
property is not mandatory but is accepted by the server as it is part of the GET response.
Deleting a Document
DELETE http://NUXEO_SERVER/nuxeo/api/v1/id/{idOfTheDoc}
Learn More
- Test these endpoints on your local instance with Nuxeo API Playground (see documentation to configure your local instance).
- Checkout the Nuxeo REST API explorer of your instance at
http://NUXEO_SERVER/nuxeo/api/v1/doc
.