cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve metadata for a document type

deepacp
Champ in-the-making
Champ in-the-making
Hi,

Given a document type, is there any REST API to return the metadata in JSON format? Please guide me to the appropriate documentation.

Thanks
Deepa
4 REPLIES 4

niketapatel
Star Contributor
Star Contributor
   Hi, You can check this nodeRef cookbook to get content properties. Once you get required data then you can have your custom webscritp and its response in JSON format. Please check below link for webscript too.
   
   Noderef cookbook - https://wiki.alfresco.com/wiki/NodeRef_cookbook#Reading_a_property_of_a_node
   Webscript:    https://wiki.alfresco.com/wiki/Web_Scripts
   
   And there is also OOB webscript to get metadata of given noderef, if it fits in your requirement - http://<host>:<port>/alfresco/service/api/metadata?nodeRef=workspace://SpacesStore/6c9cee9a-4253-4dc5-82da-0fab14b16480

kaynezhang
World-Class Innovator
World-Class Innovator
All dictionary related Web Scripts are all in package  "/org/alfresco/repository/dictionary",You can visit at this address </code>http://localhost:8080/alfresco/service/index/package/org/alfresco/repository/dictionary</code>.

To get the class definition for a given classname , you can use  this webscript api
/alfresco/service/api/classes/{className}
.

deepacp
Champ in-the-making
Champ in-the-making
Thanks kaynezhang!

I am able to retrieve the properties but could not find any REST API with json format to update properties. I don't want to use CMIS, is there any alternative way to achieve this?

kaynezhang
World-Class Innovator
World-Class Innovator
I'm afraid there is not any webscript api that can be used directly to update properties definition with json format.

If you want to use webscipt api to update content definition,you can:
1. Deploy your content model using dynamic approach – places the model files in the content repository under Company Home/Data Dictionary/Models.
2. Get node content(model definition) using webscript api with url
GET /api/path/{store_type}/{store_id}/{nodepath}/content

3.Modify the xml content(since a content model is nothing but an XML document,you can modify the xml file directly),and then write your content back to repository using webscript api with url
 PUT api/path/{store_type}/{store_id}/{nodepath}/content{property}