Is it possible to update (post) user custom information?

Hello,

I tried to update user custom information by using the post method in the UI form.

For example, 

Url to call : ../API/customuserinfo/value/26/201

Data send on click : 

 {
    "userId": "26",
    "value": "manager1",
    "definitionId": {
      "name": "ManagerUsername",
      "description": "manager information update by an employee",
      "id": "201"
    }
  } 

I think this is wrong approach.

I tried to check the document, but I could not find a correct API yet.

https://documentation.bonitasoft.com/bonita/7.10/customuserinfo-api

Is it possible to update user custom information by rest API?

Thanks in advance,

 

Hello,

It think what you are trying to do is to update the value of an existing custom user information (the custom user information definition has already been created).
In that case, what you need to do is a PUT instead of a POST (we use PUT in the REST API for resources updates and POST for creation) with a payload like:

{
  "value":"manager1"
}

By the way, it seems the documentation page you are referring to is not totally accurate. I just opened a pull request to improve it.

HTH

Thanks for the answer. 
I tried this with POST , but I still got the error 403 forbidden.

I am going to try this with setCustomUserInfoValue https://documentation.bonitasoft.com/javadoc/api/7.10/index.html

Also Thank you for the request to improve the documentation!.

 

 

 

Ah, but you need to perform a PUT. Not a POST.
The URL would be something like: http://host:port/bonita/API/customuserinfo/value/26/201

HTH

Sorry for confusing, Yes I tried to do it with a PUT before  and got the 405 error .

Thanks.

Hi, It works with PUT  with {value: "manager1"}! 

Thanks a lot :)

Ah, yes, the user ID and definition ID don't need to be in the json payload since they are in the URL. :-)

 

Hi  anthony.birembaut

I have the same problem now. I need to update a custom user value.

I tried to API REST whit PUT services and I can resolved it, but I need to update the value with a ScriptConnector.

Can you figured out how to implement the method setCustomUserInfoValue ??

Thanks