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
{
"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 information 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 theX-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 Rest Contributors. See this blog post for a sample on how to use Rest Contributors.
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:
{
"entity-type": "document",
"type": "File",
"name": "myDocumentName",
"properties": {
"dc:title": "My Document Title"
}
}
Body for a PUT Request
A PUT request is even simpler : you only need to send the metadata you wish to update in the properties object.
{
"entity-type": "document",
"properties": {
"dc:title": "My new title"
}
}
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"
}
}
}]
}
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.
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 customised.
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.
group
{
"entity-type": "group",
"groupname": "members",
"grouplabel": "Members group",
"memberUsers": [],
"memberGroups": []
}