¿How i obtain the processDefinitionid in order to start a proces using API REST?
Hi everybody,
How i start a process , using a button in my personal page, in bonita documentation is there information about , how i start a case or how i obtain the case information, but i want to launch or start a process, when i press the button. i saw that for start a case for example i have to get the processDefinitionId, so how i obtain it , if the process still has not begun , really i'm very confused.
Regards.
Here is the REST API call to perform to get list of process definitions based on provided process name (replace "MyProcessName" with your actual process definition name):
http://localhost:8080/bonita/API/bpm/process?s=MyProcessName&p=0&c=10&o=version&f=activationState=ENABLED
If you store the result in a variable (e.g. "processDefinitionArray") you can then define another variable initialized with a JavaScript expression that will build the URL to instantiate the process (we get latest element of the array to get the latest process definition version):
return "../API/bpm/process/" +$data.processDefinitionArray[$data.processDefinitionArray.length-1].id + "/instantiation";
You can find such example in the Vacation Management example (I'm currently updating it to actually get the last version of process definition).
Hope this helps.
Comments
hi , currently i'm using php not AngularJS .In first place, this url , only retrieve me all the information about the process , through the "MyProcessName" , but now i need to launch the process when the user press the button . I think that if the process doesn't started yet , the processDefinitionId not will exist yet , therefore i will could not use it in my query .
regards
Hi,
I think you're mixing up process and case. A case is an instance of a process.
To start a new case using the API, you need to tell Bonita which process definition should be instantiated. You need the process definition id. You can retrieve it using the REST API : documentation here
Then, when you start a new case of this process definition, the API will respond with a JSON representing the newly created case (documentation here).
Regards
Quentin
Comments
Hi , i know that the case is a simple instance of a process.I know how i obtain the case information from API RETS so my question is very clear , ¿How i obtain the processDefinitionid in order to start a proces using API REST?. i posted my idea in the the first comment . regards
sorry , how i can to do this using PHP CURL, because i 'm not using Angular JS.
regards.
You keep asking about PHP CURL.
This as such is not a supported language for BonitaSoft. The answer for what you have asked is above, but you have to translate this to PHP CURL, everyone else here uses JAVA etc...
Sorry about that
regards
Hi , my quetsion is.
have you pressed the execute button from bonita studio before to do this ?
because , what i want to do is create a button in my web page and then through it , i can start the process, is it possible to do this? or before, i have to press the execute button and then send my querys.
regards
the above comment is for Quentin Choulet .
Comments
I want to make sure that I understand your question. Can you confirm that you want, from a page of your application, to allow user to start a new process instance?
To start this process instance you have two options:
Which of the two option are you trying to use?
Hi Antoine, i want to Provide a form in the application page and add a button that perform the REST call to instantiate the process.
regards