06-18-2020 04:42 AM
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.
06-18-2020 08:26 AM
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,
06-25-2020 08:02 AM
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.
06-26-2020 12:52 AM
Hello,
Any update?
06-26-2020 11:40 AM
Hi @MOH_MCT,
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.
HTH,
07-01-2020 05:48 AM
Hi @EddieMay
We followed the same steps to create a custom model as per document the same payload but still, we are not able to set property.
URI-/alfresco/api/-default-/public/alfresco/versions/1/nodes/708502be-96ff-46c2-95e9-9d07676189c4/children
Payload used-{
"nodeType": "dc:whitePaper",
"properties": {
"dc:writer": "Eddie"
}
}
After uploading property not reflected. Can you please check?
07-01-2020 08:01 AM
Hi @MOH_MCT,
Can you look up the model and its properties using the Node Browser? This should display the type & properties in case anything is not being displayed properly in Share.
07-01-2020 10:36 AM
Hi @EddieMay
I am attaching screenshots for input and output. As even call is successful property is not getting reflected in POST call.
If we trigger the same document based on node id with PUT call property is getting reflected here we are giving the same JSON.
Also attaching a screenshot for file displaying property after POST call.
Please let me know if we can connect our Webex?
09-06-2023 09:13 AM
hello @MOH_MCT, have you solved this problem?
Pleas let my know your solution.
Explore our Alfresco products with the links below. Use labels to filter content by product module.