AnsweredAssumed Answered

How to use REST API along with activiti?

Question asked by prasad1 on Jun 17, 2011
Latest reply on Jun 10, 2013 by jbarrez
How to start a process instance using POST request. I am mainly concerned about its code implementation. As with the GET request we can provide the attribute-values in query string and paste it over browser but POST data are hidden and needs some sort of interface that will send such data. The user guide mentions something about JSON and JAVA API calls. Do I need to write a JAVA code to create a process instance using REST API?

Here's where I got confused:

To get the process definitions:
Get Process Definition

Returns details about a deployed process definition.

Request: [b]GET[/b] /process-definition/{processDefinitionId}
API: ProcessEngines.getProcessEngine(configuredProcessEngineName).getProcessService().createProcessDefinitionQuery().processDefinitionId(processDefinitionId)
  "id": "financialReport:1",
  "key": "financialReport",
  "version": 1,
  "name": "Monthly financial report",
  "resourceName": "org/activiti/examples/bpmn/usertask/FinancialReportProcess.bpmn20.xml",
  "deploymentId": "10",
  "startFormResourceKey": null

But to create a process instance:

Request: [b]POST[/b] /process-instance

API: ProcessEngines.getProcessEngine(configuredProcessEngineName).getRuntimeService().startProcessInstanceById(processDefinitionId[, businessKey][, variables])
  "id": "217",
  "processDefinitionId": "financialReport:1:1700",
  "activityNames": ["writeReportTask"],
  "ended": true

Could someone please elaborate the process to use a REST API in creating a process instance. I am newbie in REST as well as ACTIVITI architecture.
Thank you in advance.