JBPM 6 - 5.0 - jBPM with REST PHP

From Training Material
Jump to navigation Jump to search

Samples of executing processes and rules in php via Kie rest

Detailed commands with json examples:

Curl
curl -v -H 'ACCEPT: application/json' 'http://krisv:krisv@10.10.1.16:8080/businesst/query/task'
Passing parameters (as on 6.5 only string allowed)

curl -l -H "Content-type: application/json" -X POST 'http://localhost/business-central/rest/runtime/GeneraliChina:rms:4.0/process/B01Master/start?map_pvSurveyID=123'


Documentation


Example of getting tasks

 <?php
 $username='admin';
 $password='admin';
 $URL="http://localhost:8080/jbpm-console/rest/task/query";
 
 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL,$URL);
 curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds
 curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
 curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
 
 $headers = array(
     'Content-Type:application/json',
     'Authorization: Basic '. base64_encode("krisv:krisv") // <---
 );
  
 curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
 $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);   //get status code
 $result=curl_exec ($ch);
 print_r($result);
 curl_close ($ch);