AnsweredAssumed Answered

update content properties through REST API

Question asked by goebel on Oct 31, 2012
Latest reply on Apr 29, 2015 by

I try to update the properties (title, description, …) through the REST API but I do not succeed.
With a cmis client it works fine but I do not want to add the apache chemistry jar's to my project. I prefer doing all the manipulations (login, search, retrieve, update) through the rest api. I also prefer doing all the data exchange with json format and not with xml. (like the result of a search 'alfresco/service/api/search' )

I managed to get quite a lot to do without adding cmis jar's to my project but updating the properties of a content requires according to the documentation an atomentry which is an xml content.
I can generate this xml content by hand but it is quite noisy and when I have to do that I can alos include the jar's which generate it for me.

Is there a way in alfresco (4.1 or 4.2) to do all the manipulations through the REST API with JSON ? If so how (mainly for updating the properties) ? 

Here is what I managed to get to work

alfresco/service/api/login -> get Login token = JSON : perfect
alfresco/service/api/search/keyword.atom -> get search result : XML :-(
alfresco/service/api/node/content/workspace/SpacesStore/538653c7…….. -> get content = DATA : perfect
alfresco/service/api/metadata -> get Properties = JSON : perfect
alfresco/service/api/node/workspace/SpacesStore/53865….. -> put of new properties : XML atomentry :-(

I tried to update the metadata through the 'Node Metadata Storage Service' service (POST /alfresco/service/api/metadata/node/{store_type}/{store_id}/{id}) which sends me back a 'successfull' in JSON format, but the properties are not modified in alfresco. So what is this service good for ?

Any help or suggestions are appreciated.


Georges Goebel

Update Object (updateProperties)
PUT /alfresco/service/cmis/i/{id}
PUT /alfresco/service/cmis/s/{store}/i/{id}
PUT /alfresco/service/cmis/p{path}
PUT /alfresco/service/cmis/s/{store}/p{path}
PUT /alfresco/service/api/node/{store_type}/{store_id}/{id}
PUT /alfresco/service/api/path/{store_type}/{store_id}/{nodepath}

Update the properties of the specified Object.

Authentication:   user
Transaction:   required
Format Style:   argument
Default Format:   atomentry
Lifecycle:   public_api
Id:   org/alfresco/cmis/item.put
Descriptor:   classpath:alfresco/templates/webscripts/org/alfresco/cmis/item.put.desc.xml