Start Process Instance

Instantiates a given process definition. Process variables and business key may be supplied in the request body.

Method

POST /process-definition/{id}/start

POST /process-definition/key/{key}/start (starts the latest version of the process definition which belongs to no tenant)

POST /process-definition/key/{key}/tenant-id/{tenant-id}/start (starts the latest version of the process definition for tenant)

Parameters

Path Parameters

Name Description
id The id of the process definition to be retrieved.
key The key of the process definition (the latest version thereof) to be retrieved.
tenant-id The id of the tenant the process definition belongs to.

Request Body

A JSON object with the following properties: (at least an empty JSON object {} or an empty request body)

Name Description
variables A JSON object containing the variables the process is to be initialized with. Each key corresponds to a variable name and each value to a variable value. A variable value is a JSON object with the following properties:

Name Description
value The variable's value. For variables of type Object, the serialized value has to be submitted as a String value.

For variables of type File the value has to be submitted as Base64 encoded string.

type The value type of the variable.
valueInfo A JSON object containing additional, value-type-dependent properties.

For serialized variables of type Object, the following properties can be provided:

  • objectTypeName: A string representation of the object's type name.
  • serializationDataFormat: The serialization format used to store the variable.

For serialized variables of type File, the following properties can be provided:

  • filename: The name of the file. This is not the variable name but the name that will be used when downloading the file again.
  • mimetype: The MIME type of the file that is being uploaded.
  • encoding: The encoding of the file that is being uploaded.

The following property can be provided for all value types:

  • transient: Indicates whether the variable should be transient or not. See documentation for more informations.

businessKey The business key the process instance is to be initialized with. The business key uniquely identifies the process instance in the context of the given process definition.
caseInstanceId The case instance id the process instance is to be initialized with.
startInstructions Optional. A JSON array of instructions that specify which activities to start the process instance at. If this property is omitted, the process instance starts at its default blank start event.

The instructions are executed in the order they are in. An instruction may have the following properties:

Name Description
type Mandatory. One of the following values: startBeforeActivity, startAfterActivity, startTransition. A startBeforeActivity instruction requests to start execution before entering a given activity. A startAfterActivity instruction requests to start at the single outgoing sequence flow of a given activity. A startTransition instruction requests to execute a specific sequence flow.
activityId Can be used with instructions of types startBeforeActivity and startAfterActivity. Specifies the activity the instruction targets.
transitionId Can be used with instructions of types startTransition. Specifies the sequence flow to start.
variables

Can be used with instructions of type startBeforeActivity, startAfterActivity, and startTransition. A JSON object containing variable key-value pairs. Each key is a variable name and each value a JSON variable value object.

Name Description
value The variable's value. For variables of type Object, the serialized value has to be submitted as a String value.

For variables of type File the value has to be submitted as Base64 encoded string.

type The value type of the variable.
valueInfo A JSON object containing additional, value-type-dependent properties.

For serialized variables of type Object, the following properties can be provided:

  • objectTypeName: A string representation of the object's type name.
  • serializationDataFormat: The serialization format used to store the variable.

For serialized variables of type File, the following properties can be provided:

  • filename: The name of the file. This is not the variable name but the name that will be used when downloading the file again.
  • mimetype: The MIME type of the file that is being uploaded.
  • encoding: The encoding of the file that is being uploaded.

The following property can be provided for all value types:

  • transient: Indicates whether the variable should be transient or not. See documentation for more informations.
local Indicates whether the variable should be a local variable or not. If set to true, the variable becomes a local variable of the execution entering the target activity.

skipCustomListeners Skip execution listener invocation for activities that are started or ended as part of this request.

Note: This option is currently only respected when start instructions are submitted via the startInstructions property.

skipIoMappings Skip execution of input/output variable mappings for activities that are started or ended as part of this request.

Note: This option is currently only respected when start instructions are submitted via the startInstructions property.

withVariablesInReturn Indicates if the variables, which was used by the process instance during execution, should be returned. Default value: false

Result

A JSON object representing the newly created process instance. Properties are:

Name Type Description
id String The id of the process instance.
definitionId String The id of the process definition.
businessKey String The business key of the process instance.
caseInstanceId String The case instance id of the process instance.
tenantId String The tenant id of the process instance.
ended Boolean A flag indicating whether the instance is still running or not.
suspended Boolean A flag indicating whether the instance is suspended or not.
links Object A JSON array containing links to interact with the instance.
variables Object A JSON object containing a property for each of the latest variables. The key is the variable name, the value is a JSON object of serialized variable values with the following properties:
Name Value Description
value String / Number / Boolean / Object The variable's value.
type String The value type of the variable.
valueInfo Object A JSON object containing additional, value-type-dependent properties.

For variables of type Object, the following properties are returned:

  • objectTypeName: A string representation of the object's type name.
  • serializationDataFormat: The serialization format used to store the variable.

The following property can be returned for all value types:

  • transient: exposed if the value is set to true. See documentation for more informations.

Response Codes

Code Media type Description
200 application/json Request successful.
400 application/json The instance could not be created due to an invalid variable value, for example if the value could not be parsed to an Integer value or the passed variable type is not supported. See the Introduction for the error response format.
404 application/json The instance could not be created due to a non existing process definition key. See the Introduction for the error response format.
500 application/json The instance could not be created successfully. See the Introduction for the error response format.

Example

Starting a process instance at its default initial activity:

Request

POST /process-definition/aProcessDefinitionId/start

POST /process-definition/key/aProcessDefinitionKey/start

Request body:

{
  "variables": {
    "aVariable" : {
        "value" : "aStringValue",
        "type": "String"
    },
    "anotherVariable" : {
      "value" : true,
      "type": "Boolean"
    }
  },
 "businessKey" : "myBusinessKey"
}

Response

{
  "links": [
    {
      "method": "GET",
      "href":"http://localhost:8080/rest-test/process-instance/anId",
      "rel":"self"
    }
  ],
  "id":"anId",
  "definitionId":"aProcessDefinitionId",
  "businessKey":"myBusinessKey",
  "tenantId":null,
  "ended":false,
  "suspended":false
}

Starting a process instance with variables in return:

Request

POST /process-definition/aProcessDefinitionId/start

POST /process-definition/key/aProcessDefinitionKey/start

Request body:

{
 "variables":{
   "aVariable" : {
     "value" : "aStringValue",
     "type": "String"},
   "anotherVariable" : {
     "value" : true,
     "type": "Boolean",
     "valueInfo" : {
        "transient" : true
      }
    }
 },
 "businessKey" : "myBusinessKey",
 "withVariablesInReturn": true
}

Response

{
  "links": [
    {
      "method": "GET",
      "href": "http://localhost:8080/rest-test/process-instance/aProcInstId",
      "rel": "self"
    }
  ],
  "id": "aProcInstId",
  "definitionId": "aProcessDefinitionId",
  "businessKey": "myBusinessKey",
  "ended": false,
  "suspended": false,
  "tenantId": null,
  "variables": {
    "anotherVariable": {
        "type": "Boolean",
        "value": true,
        "valueInfo": {
          "transient" : true
        }
    },
    "aVariable": {
        "type": "String",
        "value": "aStringValue",
        "valueInfo": { }
    }
  }
}

Starting a process instance at two specific activities:

Request

POST /process-definition/aProcessDefinitionId/start

POST /process-definition/key/aProcessDefinitionKey/start

Request Body:

{
  "variables": {
    "aProcessVariable" : {
      "value" : "aStringValue",
      "type": "String"
    }
  },
  "businessKey" : "myBusinessKey",
  "skipCustomListeners" : true,
  "startInstructions" :
    [
      {
        "type": "startBeforeActivity",
        "activityId": "activityId",
        "variables": {
          "var": {
            "value": "aVariableValue",
            "local": false,
            "type": "String"}
        }
      },
      {
        "type": "startAfterActivity",
        "activityId": "anotherActivityId",
        "variables": {
          "varLocal": {
            "value": "anotherVariableValue",
            "local": true,
            "type": "String"
          }
        }
      }
    ]
}

Response

{
  "links": [
    {
      "method": "GET", 
      "href":"http://localhost:8080/rest-test/process-instance/anId",
      "rel":"self"
    }
  ],
  "id":"anId",
  "definitionId":"aProcessDefinitionId",
  "businessKey":"myBusinessKey",
  "tenantId":null,
  "ended":false,
  "suspended":false
}

On this Page: