Retrieves the start form variables for a process definition (only if they are defined via the Generated Task Form approach).The start form variables take form data specified on the start event into account. If form fields are defined,the variable types and default values of the form fields are taken into account.
Method
GET /process-definition/{id}/form-variables
GET /process-definition/key/{key}/form-variables
(returns the form variables for the latest process definition which belongs to no tenant).
GET /process-definition/key/{key}/tenant-id/{tenant-id}/form-variables
(returns the form variables for the latest version of process definition for tenant)
Parameters
Path Parameters
Name | Description |
---|---|
id | The id of the process definition to retrieve the variables 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. |
Query Parameters
Name | Description |
---|---|
variableNames | A comma-separated list of variable names. Allows restricting the list of requested variables to the variable names in the list. It is best practice to restrict the list of variables to the variables actually required by the form in order to minimize fetching of data. If the query parameter is ommitted all variables are fetched. If the query parameter contains non-existent variable names, the variable names are ignored. |
deserializeValues | Determines whether serializable variable values (typically variables that store custom Java objects) should be deserialized on server side (default true ). |
If set to true
, a serializable variable will be deserialized on server side and transformed to JSON using Jackson's POJO/bean property introspection feature. Note that this requires the Java classes of the variable value to be on the REST API's classpath.
If set to false
, a serializable variable will be returned in its serialized format. For example, a variable that is serialized as XML will be returned as a JSON string containing XML.
Note: While true
is the default value for reasons of backward compatibility, we recommend setting this parameter to false
when developing web applications that are independent of the Java process applications deployed to the engine.
Result
A JSON object containing a property for each variable returned. The key is the variable name, thevalue is a JSON object with the following properties:
Name | Value | Description |
---|---|---|
value | String / Number / Boolean / Object | The variable's value. Value differs depending on the variable's type and on the deserializeValues parameter. |
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.
Response Codes
Code | Media type | Description |
---|---|---|
200 | application/xhtml+xml | Request successful. |
404 | application/json | Process definition with given key does not exist. See the Introduction for the error response format. |
Example
Request
GET /process-definition/anId/form-variables
GET /process-definition/anId/form-variables?variableNames=a,b,c
GET /process-definition/key/aKey/form-variables
Response
{
"amount": {
"type": "Integer",
"value": 5,
"valueInfo": {}
},
"firstName": {
"type": "String",
"value": "Jonny",
"valueInfo": {}
}
}
原文: https://docs.camunda.org/manual/7.9/reference/rest/process-definition/get-form-variables/