Adding customize metadata with rest api
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2018 12:29 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2018 03:28 PM
Check out Special HTTP Headers: header X-NXDocumentProperties=* https://doc.nuxeo.com/nxdoc/special-http-headers/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2018 04:29 PM
I am using Postman for the client and in the Headers tab I put the following data
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2018 06:01 PM
I created new POST request taking from the nuxeo documentation https
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2018 01:21 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2018 05:13 AM
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
