Get Jobs (POST)
Queries for jobs that fulfill given parameters. This method is slightly more powerful than the Get Jobs method because it allows filtering by multiple jobs of types String
, Number
or Boolean
.
Method
POST /job
Parameters
Query Parameters
Name | Description |
---|---|
firstResult | Pagination of results. Specifies the index of the first result to return. |
maxResults | Pagination of results. Specifies the maximum number of results to return. Will return less results if there are no more results left. |
Request Body
A JSON object with the following properties:
Name | Description | ||||||
---|---|---|---|---|---|---|---|
jobId | Filter by job id. | ||||||
jobIds | Filter by a JSON array of job ids. | ||||||
jobDefinitionId | Only select jobs which exist for the given job definition. | ||||||
processInstanceId | Only select jobs which exist for the given process instance. | ||||||
processInstanceIds | Only select jobs which exist for the given a JSON array of process instance ids. | ||||||
executionId | Only select jobs which exist for the given execution. | ||||||
processDefinitionId | Filter by the id of the process definition the jobs run on. | ||||||
processDefinitionKey | Filter by the key of the process definition the jobs run on. | ||||||
activityId | Only select jobs which exist for an activity with the given id. | ||||||
withRetriesLeft | Only select jobs which have retries left. Value may only be true , as false is the default behavior. |
||||||
executable | Only select jobs which are executable, i.e., retries > 0 and due date is null or due date is in the past. Value may only be true , as false is the default behavior. |
||||||
timers | Only select jobs that are timers. Cannot be used together with messages . Value may only be true , as false is the default behavior. |
||||||
messages | Only select jobs that are messages. Cannot be used together with timers . Value may only be true , as false is the default behavior. |
||||||
dueDates | Only select jobs where the due date is lower or higher than the given date.
Due date expressions are given in an array of objects that have two properties `operator` and `value`.operator is the comparison operator to be used and value the date value as string.Valid operator values are: gt - greater than; lt - lower than.value may not contain underscore or comma characters.
|
||||||
createTimes | Only select jobs created before or after the given date.
Create time expressions are given in an array of objects that have two properties `operator` and `value`.operator is the comparison operator to be used and value the date value as string.Valid operator values are: gt - greater than; lt - lower than.value may not contain underscore or comma characters.
|
||||||
withException | Only select jobs that failed due to an exception. Value may only be true , as false is the default behavior. |
||||||
exceptionMessage | Only select jobs that failed due to an exception with the given message. | ||||||
failedActivityId | Only select jobs that failed due to an exception at an activity with the given id. | ||||||
noRetriesLeft | Only select jobs which have no retries left. Value may only be true , as false is the default behavior. |
||||||
active | Only include active jobs. Value may only be true , as false is the default behavior. |
||||||
suspended | Only include suspended jobs. Value may only be true , as false is the default behavior. |
||||||
priorityLowerThanOrEquals | Only include jobs with a priority lower than or equal to the given value. Value must be a valid long value. |
||||||
priorityHigherThanOrEquals | Only include jobs with a priority higher than or equal to the given value. Value must be a valid long value. |
||||||
tenantIdIn | Only include jobs which belong to one of the given list a JSON array of tenant ids. | ||||||
withoutTenantId | Only include jobs which belong to no tenant. Value may only be true , as false is the default behavior. |
||||||
includeJobsWithoutTenantId | Include jobs which belong to no tenant. Can be used in combination with tenantIdIn . Value may only be true , as false is the default behavior. |
||||||
sorting |
A JSON array of criteria to sort the result by. Each element of the array is a JSON object that specifies one ordering. The position in the array identifies the rank of an ordering, i.e., whether it is primary, secondary, etc. The ordering objects have the following properties:
|
Result
A JSON array of job objects. Each job object has the following properties:
Name | Value | Description |
---|---|---|
id | String | The id of the job. |
jobDefinitionId | String | The id of the associated job definition. |
dueDate | String | The date on which this job is supposed to be processed. |
processInstanceId | String | The id of the process instance which execution created the job. |
executionId | String | The specific execution id on which the job was created. |
processDefinitionId | String | The id of the process definition which this job belongs to. |
processDefinitionKey | String | The key of the process definition which this job belongs to. |
retries | Number | The number of retries this job has left. |
exceptionMessage | String | The message of the exception that occurred, the last time the job was executed. Is null when no exception occurred. |
failedActivityId | String | The id of the activity on which the last exception occurred, the last time the job was executed. Is null when no exception occurred. |
suspended | Boolean | A flag indicating whether the job is suspended or not. |
priority | Number | The job's priority for execution. |
tenantId | String | The id of the tenant which this job belongs to. |
createTime | String | The date on which this job has been created. |
Response Codes
Code | Media type | Description |
---|---|---|
200 | application/json | Request successful. |
400 | application/json | Returned if some of the query parameters are invalid, for example if a sortOrder parameter is supplied, but no sortBy , or if an invalid operator for due date comparison is used. See the Introduction for the error response format. |
Example
Request
POST /job
Request Body:
{
"dueDates":
[
{
"operator": "gt",
"value": "2018-07-17T17:00:00.000+0200"
},
{
"operator": "lt",
"value": "2018-07-17T18:00:00.000+0200"
}
],
"createTimes":
[
{
"operator": "gt",
"value": "2012-05-05T10:00:00.000+0200"
},
{
"operator": "lt",
"value": "2012-07-16T15:00:00.000+0200"
}
],
"sorting":
[
{
"sortBy": "jobDueDate",
"sortOrder": "asc"
},
{
"sortBy": "jobRetries",
"sortOrder": "asc"
}
]
}
Response
[
{
"id": "aJobId",
"jobDefinitionId": "aJobDefinitionId",
"dueDate": "2018-07-17T17:05:00.000+0200",
"processInstanceId": "aProcessInstanceId",
"processDefinitionId": "aProcessDefinitionId",
"processDefinitionKey": "aPDKey",
"executionId": "anExecutionId",
"retries": 0,
"exceptionMessage": "An exception Message",
"failedActivityId": "anActivityId",
"suspended": false,
"priority": 10,
"tenantId": null,
"createTime": "2018-05-05T17:00:00+0200"
},
{
"id": "anotherJobId",
"jobDefinitionId": "anotherJobDefinitionId",
"dueDate": "2018-07-17T17:55:00.000+0200",
"processInstanceId": "aProcessInstanceId",
"processDefinitionId": "anotherPDId",
"processDefinitionKey": "anotherPDKey",
"executionId": "anotherExecutionId",
"retries": 0,
"exceptionMessage": "Another exception Message",
"failedActivityId": "anotherActivityId",
"suspended": true,
"priority": 8,
"tenantId": null,
"createTime": "2018-05-05T17:00:00+0200"
}
]