As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
Hi,
I am using Rest API to upload a document i.e POST /nodes/{nodeid}. My question here is how to set a custom property with a document that is defined under the content model.
Hi @MOH_MCT,
If you have a custom model, I believe you can reference your custom model like so:
"nodeType=acme:document"
You can see the documentation here.
To add/update custom properties you would add something like this:
"properties": { "cm:title": "My text", "acme:securityClassification": "Public", "cm:versionType": "MAJOR", "acme:documentId": "DOC001", "cm:versionLabel": "1.0", "cm:description": "My custom text document description" }
In the example above you can see that the "acme" content model has a "documentId" custom property/metadata.
HTH,
Hi @EddieMay
With POST call /node/nodeid i am unable to add custom property.
For that i am invoking two rest calls one post is for upload and second put call for adding custom property.
Hello,
Any update?
I've just run some tests using Postman on the latest Community Edition (201911 GA). What I've done is create a custom model (following the standard examples at https://docs.alfresco.com/6.2/concepts/admintools-cmm-tutorial.html). So, my custom model is dc:Whitepaper, with a custom property type "dc:writer".
The ReST API code to upload a new file of type dc:Whitepaper is as follows:
POST /alfresco/api/-default-/public/alfresco/versions/1/nodes/-my-/children?autoRename=true&alf_ticket=TICKET_81eec01da4c0a37a4a746f5554bb8af7f4f0b1a4 HTTP/1.1 Host: localhost:80 Authorization: Basic dGVzdDp0ZXN0 Content-Type: application/json Content-Type: text/plain { "name": "content-to-be-deleted3.txt", "nodeType": "dc:Whitepaper", "properties": { "dc:writer": "Eddie" } }
The file has been uploaded and the type & properties set accordingly.
Writer property set