cancel
Showing results for 
Search instead for 
Did you mean: 

Can't create or edit a task variable

pivyas
Champ in-the-making
Champ in-the-making
I am using POST Method with the url http://localhost:8080/activiti-rest/service/runtime/tasks/97821/variables to create new variables with the request body being
[
  {
    "name" : "myTaskVariable",
    "scope" : "local",
    "type" : "string",
    "value" : "Hello my friend"
  }
]

but am not able to create it. I keep getting the error
{
    "errorMessage": "Request didn't cantain a list of variables to create.",
    "statusCode": 400
}

No error is found in the tomcat logs. With PUT method also, I am getting the same error. Even when using "http://localhost:8080/activiti-rest/service/runtime/executions/97188/variables", I get the same error.
I am using chrome extension POSTMAN to make the rest-requests. Tried to pass the request body as Text/JSON/XML/HTML.. but same error is produced. Any help will be great. Thanks!!!
2 REPLIES 2

frederikherema1
Star Contributor
Star Contributor
We have test-coverage for this:

https://github.com/Activiti/Activiti/blob/9813b8adbb5bef2324d8cf52422fe658d3fba7a8/modules/activiti-... -  public void testCreateSingleTaskVariable()

Are you sure the body JSON contains no errors? Have you tried doing it with another client (e.g.. CURL)

jestermonkey
Champ in-the-making
Champ in-the-making
@pivyas I had the same issue with POSTMAN, so I looked at the headers and the 'Content-Type' was missing. Once you add the 'Content-Type: application/json' header to the request, it works just fine.

Hope this helps.