pt35468
September 10, 2019, 11:47am
1
When I attempt to run the POST or PUT in postman or run a sample in swagger
PUT runtime/process-instances/{processInstanceId}/variables or
POST runtime/process-instances/{processInstanceId}/variables
{
"name": "variableName",
"type": "string",
"value": "testvalue",
"scope": "local"
}
I receive
{
“message”: “Bad request”,
“exception”: “Failed to serialize to a RestVariable instance”
}
joram
September 10, 2019, 11:55am
2
The variables need to be in a json array, so wrap your variable in [ ] and it should be ok.
pt35468
September 10, 2019, 12:33pm
3
When I try the following still get same error
If I remove “variables” : then get json syntax error in postman
{
“variables” : [
{
“name”: “testvariabler”,
“type”: “string”,
“value”: “testvalue”,
“scope”: “local”
}
]
}
pt35468
September 10, 2019, 12:41pm
4
During my google research someone had same issue but with alfresco
https://community.alfresco.com/thread/231605-failed-to-serialize-to-a-restvariable-instance
and it was mentioned … because RestVariable class does not implement Serializable interface. ??
joram
September 10, 2019, 12:48pm
5
pt35468
September 10, 2019, 1:05pm
6
Perfect … that works .
thanks for the help on this. I was assuming like the other rest api calls the json would begin and end with {}
Just in case you try it out, this endpoint [PUT] /runtime/tasks/{taskId}/variables/{variableName}
only accepts a single variable so unlike the POST, your body cannot include the array wrapper. Just happened upon it a couple days ago