Set list Variables with REST API

Hi !
I want to set a list of my workflow using the REST API in c#. So, I made this part of code :

object updateJson = new { id = caseIdInstance +"/listTest", name = "listTest", value = newValue, type = "java.util.Collection" }; req = new RestRequest("API/bpm/caseVariable/" + caseIdInstance +"/"+listTest, Method.PUT); req.AddCookie(restCookie.Name, restCookie.Value); req.AddHeader("Content-Type", "application/json"); req.RequestFormat = DataFormat.Json; req.AddBody(updateJson); response = ClientConnection.Execute(req); But I have this exception : {"exception":"class org.bonitasoft.web.toolkit.client.common.exception.api.APIException","message":"Error when updating case variable","stacktrace":"[org.bonitasoft.web.rest.server.datastore.bpm.cases.CaseVariableDatastore.updateVariableValue(CaseVariableDatastore.java:82), org.bonitasoft.web.rest.server.api.bpm.cases.APICaseVariable.runUpdate(APICaseVariable.java:40), org.bonitasoft.web.rest.server.api.bpm.cases.APICaseVariable.runUpdate(APICaseVariable.java:30) ...... java.lang.Thread.run(Thread.java:744)]","cause":{"exception":"class java.lang.UnsupportedOperationException","message":"Canno't create converter for class name : java.util.Collection","stacktrace":["org.bonitasoft.web.rest.server.framework.utils.converter.ConverterFactory.createConverter(ConverterFactory.java:48)","org.bonitasoft.web.rest.server.framework.utils.converter.TypeConverter.convert

I don’t find the good type to put in the “type” attribute. But when I get my list with REST request, the type of my list is “java.util.Collection” !!

I hope you’ll understand my problem. :slight_smile:

Cheers.

3 Likes

Hi,

I have exactly the same issue when I try to update a java.util.List variable with Bonita 6.5 :
java.lang.UnsupportedOperationException
Canno’t create converter for class name : java.util.List

Any solution is welcome

Best regards,
Laurent