Starts a process instance using a set of process variables and the business key. If the start event has Form Field Metadata defined, the process engine will perform backend validation for any form fields which have validators defined. See Documentation on Generated Task Forms.

Method

POST /process-definition/{id}/submit-form

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

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

Parameters

Path Parameters

Name Description
id The id of the process definition to submit the form for.
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:

Name Description
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:
NameDescription
valueThe 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.
typeThe 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.

|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.
    |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.
    |business key|A JSON object containing the business key the process is to be initialized with. The business key uniquely identifies the process instance in the context of the given process definition.

Result

This method returns no content.

Response Codes

Code Media type Description
204 Request successful.
400 application/json The variable value or type is invalid, 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 Process definition with given key does not exist. 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

Request

POST /process-definition/aProcessDefinitionId/submit-form

POST /process-definition/key/aProcessDefinitionKey/submit-form

Request Body:

  1. {
  2. "variables": {
  3. "aVariable" : {
  4. "value" : "aStringValue",
  5. "type": "String",
  6. "valueInfo" : {
  7. "transient" : true
  8. }
  9. },
  10. "anotherVariable" : {
  11. "value" : true,
  12. "type": "Boolean"
  13. }
  14. },
  15. "businessKey" : "myBusinessKey"
  16. }

Response

  1. {"links":[{"method": "GET", "href":"http://localhost:8080/rest-test/process-instance/anId","rel":"self"}],
  2. "id":"anId",
  3. "definitionId":"aProcessDefinitionId",
  4. "businessKey":"myBusinessKey",
  5. "ended":false,
  6. "suspended":false}

原文: https://docs.camunda.org/manual/7.9/reference/rest/process-definition/post-submit-form/