Server

REST API Entity Types

Updated: December 4, 2024

We reference here sample JSON objects expected by the Resources Endpoints, that you may want to use and adapt when doing POST and PUT. You can experiment Nuxeo API and see the list of endpoints on the Nuxeo API Playground.

document

Result of a GET Request

GET Request

{
  "entity-type": "document",
  "repository": "default",
  "uid": "dac9ef1d-0ca0-4946-93ed-048021b506d9",
  "path": "/default-domain",
  "type": "Domain",
  "state": "project",
  "versionLabel": "",
  "isCheckedOut": true,
  "title": "Default domain",
  "lastModified": "2014-06-06T10:23:59.76Z",
  "properties": {
    "dc:creator": "system",
    "dc:source": "Wikipedia",
    "dc:nature": "application",
    "dc:contributors": [
      "system",
      "Administrator"
    ],
    "dc:created": "2012-08-01T10:00:57.75Z",
    "dc:description": "",
    "dc:rights": "Creative Common",
    "dc:subjects": [
      "art/cinema",
      "technology/electronic"
    ],
    "dc:publisher": null,
    "dc:valid": null,
    "dc:format": "XML",
    "dc:issued": null,
    "dc:modified": "2014-06-06T10:23:59.76Z",
    "dc:expired": "2014-06-18T22:00:00.00Z",
    "dc:coverage": "asia/Bahrain",
    "dc:language": "EN",
    "dc:title": "Default domain",
    "dc:lastContributor": "Administrator",
    "common:icon": "/icons/domain.gif",
    "common:icon-expanded": null,
    "common:size": null,
    "domain:content_roots": [],
    "domain:display_type": "false"
  },
  "facets": [
    "SuperSpace",
    "DocumentsSizeStatistics",
    "Folderish",
    "DocumentsCountStatistics",
    "NotCollectionMember"
  ],
  "changeToken": "1402050239761",
  "contextParameters": {}
}

A few useful items to understand the data exposed on the document:

  • properties is an object of metadata values. Each property of this object is the XPath of the field ( dc:title for example), and the value of the field. For multivalued fields, we have an array of values. Note that the content of this property may vary depending on which schemas you requested using the X-NXDocumentProperties header, as well as which properties you configured on your document type, using Nuxeo Studio. See the repository documentation for more information.
  • facets lists the facets that were declared on your document type.
  • changeToken is generated by Nuxeo and may be used server-side for some concurrent modifications safety check.
  • contextParameters is filled when calling Content Enrichers. See this blog post for a sample on how to use Content Enrichers.

Body for a POST Request

When doing a POST request to create a document, you only need to specify a few elements: entity-type, document type and name. The properties object can be used to send more metadata. Here is a sample below:

POST Request Body

{
  "entity-type": "document",
  "type": "File",
  "name": "myDocumentName",
  "properties": {
    "dc:title": "My Document Title",
    "demo:aDateProperty": "2050-12-25",
    "demo:aStringMultivaluedProperty": ["some", "text", "here"],
    "demo:aComplexProperty": {"firstName": "Chuck", "lastName": "Norris",
      "birthDate": "1968-12-25"},
    "demo:aMultivaluedComplexProperty": [
      {"firstName": "Chuck", "lastName": "Norris", "birthDate": "1968-12-25"},
      {"firstName": "Bruce", "lastName": "Lee", "birthDate": "1965-10-21"}
    ]
  }
}

A few useful items to understand the data exposed on the document:

  • demo:aDateProperty - Timezones are not needed for dates, but you can add it if you want to.
  • demo:aStringMultivaluedProperty - Multivalued properties must be sent as JavaScript arrays.
  • demo:aComplexProperty - Complex properties must be sent as JavaScript objects.
  • demo:aMultivaluedComplexProperty - Complex multi-valued properties are sent as arrays of JavaScript objects.

Body for a PUT Request

A PUT request is even simpler: you only need to send the entity type and the metadata you wish to update in the properties object.

PUT Request Body

{
  "entity-type": "document",
  "properties": {
    "dc:title": "My Updated Title"
  }
}

Partial updates to documents are allowed. In this case, update dc:title but not the rest.

directoryEntry

{
  "entity-type": "directoryEntry",
  "directoryName": "continent",
  "properties": {
    "id": "oceania",
    "obsolete": "0",
    "ordering": "10000000",
    "label": "label.directories.continent.oceania"
  }
}

The list of properties depends on the schema of the directory. See the developer documentation for more information.

Directories are documented in the developer section. To create a new vocabulary (a directory specialized for combo boxes component), you can use the vocabulary feature of Nuxeo Studio.

directoryEntries

{
  "entity-type": "directoryEntries",
  "entries": [{
    "entity-type": "directoryEntry",
    "directoryName": "continent",
    "properties": {
      "id": "europe",
      "obsolete": "0",
      "ordering": "10000000",
      "label": "label.directories.continent.europe"
    }
  }, {
    "entity-type": "directoryEntry",
    "directoryName": "continent",
    "properties": {
      "id": "africa",
      "obsolete": "0",
      "ordering": "10000000",
      "label": "label.directories.continent.africa"
    }
  }, {
    "entity-type": "directoryEntry",
    "directoryName": "continent",
    "properties": {
      "id": "north-america",
      "obsolete": "0",
      "ordering": "10000000",
      "label": "label.directories.continent.north-america"
    }
  }]
}

group

{
  "entity-type": "group",
  "groupname": "members",
  "grouplabel": "Members group",
  "memberUsers": [],
  "memberGroups": []
}

user

{
  "entity-type": "user",
  "id": "Bill",
  "properties": {
    "lastName": "Murray",
    "username": "Bill",
    "email": "[email protected]",
    "company": "",
    "firstName": "Bill",
    "password": "",
    "groups": [
      "members",
      "ecm-experts",
      "hr_operational_managers"
    ]
  },
  "extendedGroups": [{
    "name": "members",
    "label": "Members group",
    "url": "group/members"
  }, {
    "name": "ecm-experts",
    "label": "ECM experts",
    "url": "group/ecm-experts"
  }, {
    "name": "hr_operational_managers",
    "label": "",
    "url": "group/hr_operational_managers"
  }, {
    "name": "doc:default:ac6e425b-262b-41ed-bbdd-b79c22d06657_members",
    "label": "doc:default:ac6e425b-262b-41ed-bbdd-b79c22d06657_members",
    "url": "group/doc:default:ac6e425b-262b-41ed-bbdd-b79c22d06657_members"
  }, {
    "name": "doc:default:b6994e9f-636c-484b-bc46-d4fd9071e432_members",
    "label": "doc:default:b6994e9f-636c-484b-bc46-d4fd9071e432_members",
    "url": "group/doc:default:b6994e9f-636c-484b-bc46-d4fd9071e432_members"
  }, {
    "name": "doc:default:ac6e425b-262b-41ed-bbdd-b79c22d06657_administrators",
    "label": "doc:default:ac6e425b-262b-41ed-bbdd-b79c22d06657_administrators",
    "url": "group/doc:default:ac6e425b-262b-41ed-bbdd-b79c22d06657_administrators"
  }],
  "isAdministrator": false,
  "isAnonymous": false
}
  • properties: those are the properties defined for the user. They can be customized.

  • extendedGroups: this section gathers the explicit groups and the computed groups (See an exemple of using the computed groups). This section is computed server-side and is not taken into account when posting a user object.

acl

GET Request Response

{
  "entity-type": "acls",
  "acl": [{
    "name": "local",
    "ace": [{
      "username": "jdoe",
      "permission": "ReadWrite",
      "granted": true
    }]
  }, {
    "name": "inherited",
    "ace": [{
      "username": "Administrator",
      "permission": "Everything",
      "granted": true
    }, {
      "username": "members",
      "permission": "Read",
      "granted": true
    }]
  }]
}

workflow

Result of a GET Request

GET Request

{
  "entity-type": "workflow",
  "id": "05fd04ca-9f4f-42e8-89f1-5e529477f8da",
  "name": "SerialDocumentReview",
  "title": "wf.serialDocumentReview.SerialDocumentReview",
  "state": "running",
  "workflowModelName": "SerialDocumentReview",
  "initiator": "Administrator",
  "attachedDocumentIds": [{
      "id": "4d2a827e-3191-469e-8b61-fe7c07304c2c"
  }],
  "variables": {
    "validationOrReview": "validation",
    "participants": [
      "user:john",
      "group:mobilityExperts"
    ],
    "initiatorComment": "",
    "index": 0
  },
  "graphResource": "http://demo.nuxeo.com/nuxeo/site/api/v1/workflow/05fd04ca-9f4f-42e8-89f1-5e529477f8da/graph"
}

Body for a POST Request

When doing a POST request to start a workflow, you only need to specify a few elements: entity-type, workflowModelName and attachedDocumentIds. Variables are not necessary to just start the workflow.

POST Request Body

{
  "entity-type": "workflow",
  "workflowModelName": "ParallelDocumentReview",
  "attachedDocumentIds": [{
    "id": "95cb364d-8cc7-45b0-b943-e3d68376694b"
  }]
}

task

Result of a GET Request

GET Request

{
  "entity-type": "task",
  "id": "7bb67cd2-5848-4687-93af-30b3e715453e",
  "name": "wf.serialDocumentReview.DocumentValidation",
  "workflowInstanceId": "05fd04ca-9f4f-42e8-89f1-5e529477f8da",
  "workflowModelName": "SerialDocumentReview",
  "state": "opened",
  "directive": "wf.serialDocumentReview.AcceptReject",
  "created": "2015-02-24T23:12:53.81Z",
  "dueDate": "2015-03-01T23:12:53.81Z",
  "nodeName": "Task6d8",
  "targetDocumentIds": [{
    "id": "4d2a827e-3191-469e-8b61-fe7c07304c2c"
  }],
  "actors": [{
    "id": "user:john"
  }],
  "comments": [],
  "variables": {
    "comment": "",
    "participants": [
      "user:john",
      "group:mobilityExperts"
    ],
    "initiatorComment": ""
  },
  "taskInfo": {
    "taskActions": [{
      "name": "reject",
      "url": "http://demo.nuxeo.com/nuxeo/site/api/v1/task/7bb67cd2-5848-4687-93af-30b3e715453e/reject",
      "label": "wf.serialDocumentReview.Reject"
    }, {
      "name": "validate",
      "url": "http://demo.nuxeo.com/nuxeo/site/api/v1/task/7bb67cd2-5848-4687-93af-30b3e715453e/validate",
      "label": "wf.serialDocumentReview.Validate"
    }],
    "layoutResource": {
      "name": "Task6d8@taskLayout",
      "url": "http://demo.nuxeo.com/nuxeo/site//layout-manager/layouts/?layoutName=Task6d8@taskLayout"
    },
    "schemas": [{
      "name": "var_Task6d8",
      "url": "http://demo.nuxeo.com/nuxeo/site/api/v1/config/schemas/var_Task6d8"
    }, {
      "name": "dublincore",
      "url": "http://demo.nuxeo.com/nuxeo/site/api/v1/config/schemas/dublincore"
    }, {
      "name": "route_node",
      "url": "http://demo.nuxeo.com/nuxeo/site/api/v1/config/schemas/route_node"
    }]
  }
}

  • Variables: Variables are either the ones defined on the associated node from the workflow model or global variables (defined at workflow level).
  • taskActions: task actions have a PATH param (url), which will be used to send PUT requests to complete the task.

Body for a PUT Request

When doing a PUT request to complete a task, you only need to specify a few elements: entity-type (task), id (of the task), variables (if any). The elements you need to specify depend on the task you are completing.

In the example below, we'll use the task we got from the GET request above whose name is wf.serialDocumentReview.DocumentValidation, i.e. the validation of a document in an approval workflow. Since we want to approve the task, the PUT will be sent on the URL http://demo.nuxeo.com/nuxeo/site/api/v1/task/7bb67cd2-5848-4687-93af-30b3e715453e/validate . To reject the task, we would send the PUT request on the URL http://demo.nuxeo.com/nuxeo/site/api/v1/task/7bb67cd2-5848-4687-93af-30b3e715453e/reject .

PUT Request Body

{
  "entity-type": "task",
  "id": "7bb67cd2-5848-4687-93af-30b3e715453e",
  "variables": {
    "comment": "Document reviewed and approved on my side.",
  }
}


Related pages in developer documentation