cancel
Showing results for 
Search instead for 
Did you mean: 

Adding customize metadata with rest api

Uril_Yak
Champ on-the-rise
Champ on-the-rise

I am new to nuxeo and I would like to add customize metadata to the document, in my case it's transaction ID. For example I have created document from the file with rest api:

POST http://nuxeo/nuxeo/api/v1/id/de72f8e6-348e-477b-8824-9b1c157b4f7d { "entity-type": "document", "name":"HelloWorld.doc", "type": "File", "properties": { "dc:title": "HelloWorld.doc", "dc:description": "Created via a so cool and simple REST API", "transaction:ID": "8D9AC546-917B-4FC0-B378-000D4E968601", "file:content": { "upload-batch":"batchId-2c15a871-0f02-4889-b976-1531e52fcb0d", "upload-fileId":"0" } } }

Than I run GET request and got the following response: { "entity-type": "document", "repository": "default", "uid": "3fb01c07-e0cf-4167-ad91-0fa7304a2442", "path": "/default-domain/workspaces/Sample Content/PDF and Office Documents/HelloWorld.doc", "type": "File", "state": "project", "parentRef": "de72f8e6-348e-477b-8824-9b1c157b4f7d", "isCheckedOut": true, "isVersion": false, "isProxy": false, "changeToken": "5-0", "title": "HelloWorld.doc", "lastModified": "2018-04-27T15:07:47.420Z", "properties": { "uid:uid": null, "uid:major_version": 0, "uid:minor_version": 0, "thumb:thumbnail": { "name": "HelloWorld.png", "mime-type": "image/png", "encoding": null, "digestAlgorithm": "MD5", "digest": "fc05bb5bc325e52720d11f084d2aa919", "length": "756", "data": "http://10.204.20.153/nuxeo/nxfile/default/3fb01c07-e0cf-4167-ad91-0fa7304a2442/thumb:thumbnail/HelloWorld.png" }, "file:content": { "name": "HelloWorld.doc", "mime-type": "application/msword", "encoding": null, "digestAlgorithm": "MD5", "digest": "b275cf878138a65f4aed3324c3f20b78", "length": "23040", "data": "http://10.204.20.153/nuxeo/nxfile/default/3fb01c07-e0cf-4167-ad91-0fa7304a2442/file:content/HelloWorld.doc" }, "common:icon-expanded": null, "common:icon": "/icons/word.png", "files:files": [], "dc:description": "Created via a so cool and simple REST API", "dc:language": null, "dc:coverage": null, "dc:valid": null, "dc:creator": "Administrator", "dc:modified": "2018-04-27T15:07:47.420Z", "dc:lastContributor": "Administrator", "dc:rights": null, "dc:expired": null, "dc:format": null, "dc:created": "2018-04-27T15:07:47.420Z", "dc:title": "HelloWorld.doc", "dc:issued": null, "dc:nature": null, "dc:subjects": [], "dc:contributors": [ "Administrator" ], "dc:source": null, "dc:publisher": null, "relatedtext:relatedtextresources": [], "nxtag:tags": [] }, "facets": [ "Versionable", "NXTag", "Publishable", "Commentable", "HasRelatedText", "Thumbnail", "Downloadable" ] }

But I don't see transaction metadata, for example transaction:ID. that I added . Could you please tell me what I am doing wrong.

5 REPLIES 5

Jackie_A
Confirmed Champ
Confirmed Champ

Check out Special HTTP Headers: header X-NXDocumentProperties=* https://doc.nuxeo.com/nxdoc/special-http-headers/

Uril_Yak
Champ on-the-rise
Champ on-the-rise

I am using Postman for the client and in the Headers tab I put the following data

Uril_Yak
Champ on-the-rise
Champ on-the-rise

I created new POST request taking from the nuxeo documentation https

Rahul_Chavan
Champ in-the-making
Champ in-the-making

I was also searching for the same, but didn't find any clue if we can add custom metadata dynamically in nuxeo. For adding metadata you have to add through nuxeo studio only.

pibou_Bouvret
Elite Collaborator
Elite Collaborator

In order to add dynamic custom metadata, you must define a facet that holds a schema defining your custom metadata.

Before adding the metadata, you have to add the facet to the document (automation operation).

Now, it might be easier to create a custom doctype (that inherits File for instance) associated with the same schema