cancel
Showing results for 
Search instead for 
Did you mean: 

Starting a process instance via REST

davidcarrico
Champ in-the-making
Champ in-the-making
So I am trying to start a process instance using REST API. I have read the REST API, and am calling the following:

(POST) http://localhost:8080/activiti-rest/service/runtime/process-instances
Headers: Authorization: Basic a2VybWl0Omtlcm1pdA==

Content-Type: application/json
Body:
{"processDefinitionKey":"vacationRequest",
"variables":[
{"name":"employeeName", "value":"lola"}.
{"name":"numberOfDays", "value":"5"},
{"name":"startDate", "value":"10-08-2014 11:11"},
{"name":"vacationMotivation", "value":"tired"}
]}

Response: 400 bad request

Two questions:
1) Why would the above attempt result in 400? It is the example "Vacation Request" process definition in Activiti.
2) How do I determine which fields need to be included in this request to begin with? For example, is there a way to example the process definition to determine it needs: "employeeName", "numberOfDays", etc in order to start it.

Many thanks in advance!
Dave
4 REPLIES 4

davidcarrico
Champ in-the-making
Champ in-the-making
OK, i have solved the item #1. It appears the Format of the variables was wrong. Here is the right format (see below). I still really need answer to #2 though, thank you.

{"processDefinitionKey":"vacationRequest",
"variables":[
{"name":"employeeName", "value" : "dave"},
{"name":"numberOfDays", "value" : "5"},
{"name":"startDate", "value" : "10-08-2015 11:11"},
{"name":"vacationMotivation", "value" : "rest"}]}

davidcarrico
Champ in-the-making
Champ in-the-making

jbarrez
Star Contributor
Star Contributor
> OK - I will be the guy who answers his own question today smiley

I like that Smiley Happy

yzk0281
Champ in-the-making
Champ in-the-making
Hi Barrez and David
I am wonder that if I can add someone in this vacationRequest to approve it
How  to point the one to approve this vacationRequest ?