Page 1 of 1

openkm CE rest api not changing metadata values on a node

PostPosted:Mon Nov 23, 2020 5:12 pm
by jvezinat
Using restful API, testing via below and command line:

http://<internal>/OpenKM/services/rest/api-docs?url=/OpenKM/services/rest/swagger.json#/gropertyGroup-service/setPropertiesSimple

You can use the swagger page to test out different curls etc. Everything on the page works except for changing/editing the metadata value for a node.

IE// I can the metadata group to the node (file). Would I not just use setPropertiesSimple on that node and use the okp.<groupname>.<field> and input the new value?

I can query the node and get all the metadata properties and their values, just can't seem to change? Any tips?
Code: Select all
curl -u <user>:<pass> -X POST "http://<internal>/OpenKM/services/rest/propertyGroup/setPropertiesSimple?nodeId=9934c690-ce23-4fd6-b397-4afcb917ed10&grpName=okg%3AIandT" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"list\": [ { \"name\": \"okp.IandT.issue\", \"value\": \"testing\" } ]}"
Like i said, i can accomplish everything else but this one thing, editing a files metadata values. Thanks in advance.

Re: openkm CE rest api not changing metadata values on a node

PostPosted:Mon Nov 23, 2020 5:33 pm
by jvezinat
Disregard, I got it to work.

Re: openkm CE rest api not changing metadata values on a node

PostPosted:Thu Nov 18, 2021 7:12 pm
by vngrshakan
Hi, im facing with same issue about metadata values. When i try to add propertyGroup to nodeId its working than when i try to set value in property via rest api its returning 204 OK but doing nothing.

How did you solve your problem?

Re: openkm CE rest api not changing metadata values on a node

PostPosted:Sun Nov 21, 2021 9:30 am
by jllort
Why do not use one of our SDK ( for Java, .Net or PHP ) -> https://docs.openkm.com/kcenter/

Here are two samples https://docs.openkm.com/kcenter/view/ok ... atasamples

Re: openkm CE rest api not changing metadata values on a node

PostPosted:Mon Nov 22, 2021 6:43 am
by vngrshakan
I got where was my fault. If someone else facing this issue wanna explain here;

In the code base there is a comment in setProperties-setPropertiesSimple API and it says:
The "properties" parameter comes in the POST request body (encoded as XML or JSON).

Its working with xml same as Jilort's answer above;
Code: Select all
curl -u okmAdmin:admin -H "Accept: application/json" \
  -X PUT -H "Content-Type: application/xml" \
  -d '<simplePropertiesGroup><simplePropertyGroup><name>okp:technology.comment</name><value>RESTful rulez!</value></simplePropertyGroup></simplePropertiesGroup>' \
  http://localhost:8080/OpenKM/services/rest/propertyGroup/setPropertiesSimple?nodeId=3492d662-b58e-417c-85b6-930ad0c6c3cf\&grpName=okg:technology
But NOT working when i try with json.