cancel
Showing results for 
Search instead for 
Did you mean: 

How to use updateProperties

dranakan
Champ on-the-rise
Champ on-the-rise
Hello,

I would like to update the properties to a node with the webscript updateProperties. Can you give me an example of the URL ?
I have tried differents syntax but there dont work… Smiley Sad

Thanks

Found on : http://localhost:8080/alfresco/service/index/all

—————————————————————————————————————————————————
Update properties (updateProperties) PUT /alfresco/service/api/node/{store_type}/{store_id}/{id}
PUT /alfresco/service/api/path/{store_type}/{store_id}/{id}

This service updates properties of the specified object. As per the data model, content-streams are not properties

Inputs:

ID objectId
(Optional) String changeToken
Collection propertyCollection - Subset list of Properties to update

Outputs:

ID objectId

Notes:

Preserves the ID of the object
Subset of properties: Properties not specified in this list are not changed
To remove a property, specify property with no value
If an attempt is made to update a read-only property, throw ConstraintViolationException.
If a ChangeToken is provided by the repository when the object is retrieved, the change token MUST be included as-is when calling updateProperties.
For Multi-Value properties, the whole list of values MUST be provided on every update.
Use getAllowableActions to identify whether older version specified by ID is updatable.
If this is a private working copy, some repositories may not support updates.
Because repositories MAY automatically create new Document Versions on a user’s behalf, the objectId returned may not match the one provided as an input to this method.


Authentication: user
Transaction: required
Format Style: argument
Default Format: atomentry

Id: org/alfresco/repository/store/item.put
Descriptor: classpath:alfresco/templates/webscripts/org/alfresco/repository/store/item.put.desc.xml
4 REPLIES 4

mikeh
Star Contributor
Star Contributor
It's part of the CMIS API. http://wiki.alfresco.com/wiki/CMIS

Thanks,
Mike

dranakan
Champ on-the-rise
Champ on-the-rise
Thank you for your response.

If I have good understand, I can't use this script directly in the browser.

mikeh
Star Contributor
Star Contributor
That's correct - (broadly speaking) browsers typically only support GET and POST requests from URL and form submissions respectively. Plus CMIS is ATOM-based rather than HTML.

The metadata webscripts might be of more use to you, if you're not familiar with CMIS:
http://localhost:8080/alfresco/service/index/package/org/alfresco/repository/metadata

Thanks,
Mike

hpalma
Champ in-the-making
Champ in-the-making
Is there any example on how to call such a webscript from JAVA ?

I've created the URLConnection and then i do:

connection.setDoOutput(true);
connection.setRequestMethod("PUT");

Now the problem is, how do i pass the collection of properties that i want to update and their values ?
I know i have to use the outputstream that is given by the connection, but how and what do i serialize to an array of byte to write to the stream ?