Create Case Instance

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

Method

POST /case-definition/{id}/create

POST /case-definition/key/{key}/create (creates the latest version of the case definition which belongs to no tenant)

POST /case-definition/key/{key}/tenant-id/{tenant-id}/create (creates the latest version of the case definition for tenant)

Parameters

Path Parameters

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

Request Body

A JSON object with the following properties:

Name Description
variables A JSON object containing the variables the case instance is to be initialized with. Variable names are property keys of this object and variable values are JSON objects with a value and a type property (see example below). Valid variable values are Boolean, Number, String and Date values.
businessKey The business key the case instance is to be initialized with. The business key uniquely identifies the case instance in the context of the given case definition.

Result

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

Name Value Description
id String The id of the case instance.
caseDefinitionId String The id of the case definition this case instance belongs to.
tenantId String The id of the tenant this case instance belongs to.
businessKey String The business key of the case instance.
active Boolean A flag indicating whether the case instance is active or not.

Response Codes

Code Media type Description
200 application/json Request successful.
400 application/json The case 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.
403 application/json The case execution cannot be instantiated because of CMMN restrictions. See the Introduction for the error response format.
404 application/json The case instance could not be created due to a nonexistent case definition. See the Introduction for the error response format.
500 application/json The case instance could not be created successfully. See the Introduction for the error response format.

Example

Request

POST /case-definition/aCaseDefinitionId/create

POST /case-definition/key/aCaseDefinitionKey/create

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/case-instance/anId","rel":"self"}],
  "id":"anId",
  "caseDefinitionId":"aCaseDefinitionId",
  "tenantId":null,
  "businessKey":"myBusinessKey",
  "active":true
}

目录: