How to create a case of a process via REST Api? I don't have the processDefinitionId

Hi experts,
I’m pretty new in bonita and I need to know how to create an instance of a process (a case), via REST Api.

I’m testing with the tutorial for “Travel Requests”. I think what I have to do is call: /bonita/API/bpm/case, with a payload like this:

{ “processDefinitionId”: xxxx,
“variables”: [
{“name”: “userId” , “value” : 3},
{“name”: “destination” , “value” : “JALOBRE”},
{“name”: “departureDate” , “value” : “2017-02-09”},
{“name”: “numberOfNights” , “value” : 1},
{“name”: “hotelNeeded” , “value” : true},
{“name”: “reason” , “value” : “misco”},
{“name”: “status” , “value” : “pending”},
{“name”: “refusalReason” , “value” : “” }
]

but I don’t know how to get the processDefinitionId

Any help?

Thanks,
Jose.

Hi Jose,

To get the processDefinitionId, you can use this REST Api call that will return process information based on the process name (hopefully you know the process name).

In my example, the process name is “order”. By default, the API will return the most recent active version of the process:

REST Api call: http://localhost:8080/bonita/api/bpm/process?s=order
Result: [{“id”:“8319547991326984869”,“icon”:“”,“displayDescription”:“”,“deploymentDate”:“2016-05-08 21:42:25.325”,“description”:“”,“activationState”:“ENABLED”,“name”:“Order”,“deployedBy”:“4”,“displayName”:“Order”,“actorinitiatorid”:“1”,“last_update_date”:“2016-05-13 15:33:02.693”,“configurationState”:“RESOLVED”,“version”:“1.0”}]

Cheers
Lio

Thanks a lot for your helo Lio!