best grammar app

Integrating BonitaSoft using REST API's

Submitted by Abhishek on Wed, 2013-07-24 12:54

In one of my recent Projects, I had the task of integrating Drupal with BonitaSoft. After going through all the options, I realised, REST Services is probably going to be the best option.

Here are some of the REST options available

Instantiate a Process

This can be done using the rest call

/API/runtimeAPI/instantiateProcessWithVariables/[Process Name]

This call allows you to create a Process with variables. You would need to create an XML something like

	foreach($variables as $key=>$value){

- Do watchout for $key and $value, they should not contain HTML inside them.

Now, once you have the connection use PHP Curl to instantiate the Process

			$ch = curl_init();
			curl_setopt($ch,CURLOPT_URL, $url);
			curl_setopt($ch,CURLOPT_POST, count($fields));
			curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
			curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); 
			curl_setopt($ch, CURLOPT_VERBOSE, true);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
			$result = str_replace("\n","", curl_exec($ch));
			$raw_data = simplexml_load_string($result);
		}catch(Exception $e){

Here the $field_string would need to be created using the variables that need to be passed and would look something like

	foreach($fields as $key=>$value) { 
		$fields_string .= $key.'='.$value.'&'; 
	rtrim($fields_string, '&');

The response $raw_data contains the XML String.

Similarly, you can use

/API/runtimeAPI/setProcessInstanceVariable/[processName] To Set Process Variables
/API/runtimeAPI/deleteProcessInstance/[processName] To Delete Process
/API/runtimeAPI/executeTask/[taskName]/false Complete a Task
/API/queryRuntimeAPI/getTask/[taskName] Get a Task
/API/queryRuntimeAPI/getLightTaskListByUserId/[username]/READY Get Tasks for a User
/API/queryRuntimeAPI/getProcessInstanceVariables/[processid] Get Variables for a Process
/API/queryRuntimeAPI/getLightTaskListByActivityState/READY Get Active Tasks

Hope this is helpful to give you a guidance. My code had a lot of proprietary stuff, so have copy pasted only items I could.

Questions are welcome

Abhishek Mishra
Good experience in working with BPM technologies like Savvion, JBPM. Founder and Chief Editor of Founder of Savvion Business Manager Mobility Framework Savmobify| View my BPMGeek Profile
best grammar app

About BPMGeek

BPMGeek is an initiative to collaborate and communicate with the growing Business process management community out there. The goal is to help developers connect with experts, ask questions, post their learning and get understanding of BPM Concepts. Often tool specific knowledge of niche areas end up developers perplexed and confused - especially when there are very less number of resources available. We will be coming up several several new features. Have a look at our Roadmap here

BPMGeek is an independent entity not associated with any Product. All BPM product professionals are invited to contribute. The Logos and Names used across the site belong to their respective owners. The viewpoints mentioned by Individual contributors are their own. BPMgeek cannot be held liable for any issues arising out of it.

BPMgeek is promoting the Nounshoun English Grammar App - developed by Constellation Software.