Performs a transition from COMPLETED state to CLOSED state. In relation to the state transition, it is possible to update or delete case instance variables (please note: deletion precedes update).

Method

POST /case-instance/{id}/close

Parameters

Path Parameters

Name Description
id The id of the case instance to close.

Request Body

A JSON object with the following properties:

Name Description
Name Description
——-
variables A JSON object containing variable key-value pairs. Each key is a variable name and each value a JSON variable value object.
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.
localIndicates whether the variable must be created and/or update locally or not. If set to true, the creation or update happens locally and will not be propagated upwards in the execution hierarchy.

|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 must be created and/or update locally or not. If set to true, the creation or update happens locally and will not be propagated upwards in the execution hierarchy.
    |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 must be created and/or update locally or not. If set to true, the creation or update happens locally and will not be propagated upwards in the execution hierarchy.
    |deletions|An array containing JSON objects. Each JSON object has a property name, which is the name of the variable to delete.

Result

This method returns no content.

Response Codes

Code Media type Description
204 Request successful.
400 application/json The state transition is not allowed to be performed, for example when the case instance is active. See the Introduction for the error response format.
403 application/json The case instance cannot be closed because of CMMN restrictions. See the Introduction for the error response format.
404 application/json The case instance with given id is not found. See the Introduction for the error response format.

Example

Request

POST /case-instance/aCaseInstanceId/close

Request Body:

  1. {
  2. "variables":
  3. {
  4. "aVariable" : { "value" : "aStringValue", "type": "String" },
  5. "anotherVariable" : { "value" : true, "type": "Boolean" }
  6. },
  7. "deletions":
  8. [
  9. { "name" : "aVariableToDelete" },
  10. { "name" : "anotherVariableToDelete" }
  11. ]
  12. }

Response

Status 204. No content.

原文: https://docs.camunda.org/manual/7.9/reference/rest/case-instance/post-close/