Queries for job definitions that fulfill given parameters. This method is slightly more powerful than the Get Job Definitions method because it allows filtering by multiple job definitions of types String
, Number
or Boolean
.
Method
POST /job-definition
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 |
---|---|
jobDefinitionId | Filter by job definition id. |
activityIdIn | Only include job definitions which belong to one of the passed activity ids. |
processDefinitionId | Only include job definitions which exist for the given process definition id. |
processDefinitionKey | Only include job definitions which exist for the given process definition key. |
jobType | Only include job definitions which exist for the given job type. See the User Guide for more information about job types. |
jobConfiguration | Only include job definitions which exist for the given job configuration. For example: for timer jobs it is the timer configuration. |
active | Only include active job definitions. Value may only be true , as false is the default behavior. |
suspended | Only include suspended job definitions. Value may only be true , as false is the default behavior. |
withOverridingJobPriority | Only include job definitions that have an overriding job priority defined. The only effective value is true . If set to false , this filter is not applied. |
tenantIdIn | Only include job definitions which belong to one of the passed and comma-separated tenant ids. |
withoutTenantId | Only include job definitions which belong to no tenant. Value may only be true , as false is the default behavior. |
includeJobDefinitionsWithoutTenantId | Include job definitions 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: |
sortBy | Mandatory. Sort the results lexicographically by a given criterion. Valid values are jobDefinitionId , activityId , processDefinitionId , processDefinitionKey , jobType , jobConfiguration and tenantId . |
sortOrder | Mandatory. Sort the results in a given order. Values may be asc for ascending order or desc for descending order. |
|sortBy|Mandatory. Sort the results lexicographically by a given criterion. Valid values are
jobDefinitionId
, activityId
, processDefinitionId
, processDefinitionKey
, jobType
, jobConfiguration
and tenantId
.|sortOrder|Mandatory. Sort the results in a given order. Values may be asc
for ascending order or desc
for descending order.|sortBy|Mandatory. Sort the results lexicographically by a given criterion. Valid values are
jobDefinitionId
, activityId
, processDefinitionId
, processDefinitionKey
, jobType
, jobConfiguration
and tenantId
.|sortOrder|Mandatory. Sort the results in a given order. Values may be
asc
for ascending order or desc
for descending order.
Result
A JSON array of job definition objects.Each job definition object has the following properties:
Name | Value | Description |
---|---|---|
id | String | The id of the job definition. |
processDefinitionId | String | The id of the process definition this job definition is associated with. |
processDefinitionKey | String | The key of the process definition this job definition is associated with. |
activityId | String | The id of the activity this job definition is associated with. |
jobType | String | The type of the job which is running for this job definition. See the User Guide for more information about job types. |
jobConfiguration | String | The configuration of a job definition provides details about the jobs which will be created. For example: for timer jobs it is the timer configuration. |
overridingJobPriority | Number | The execution priority defined for jobs that are created based on this definition. May be null when the priority has not been overridden on the job definition level. |
suspended | Boolean | Indicates whether this job definition is suspended or not. |
tenantId | String | The id of the tenant this job definition is associated with. |
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 . See the Introduction for the error response format. |
Example
Request
POST /job-definition
Request Body:
{
"activityIdIn":
[
ServiceTask1, ServiceTask2
],
"sorting":
[{"sortBy": "activityId",
"sortOrder": "asc"
},
{"sortBy": "jobType",
"sortOrder": "asc"
}]
}
Response
[
{
"id": "aJobDefId",
"processDefinitionId": "aProcDefId",
"processDefinitionKey": "aProcDefKey",
"activityId": "ServiceTask1",
"jobType": "asynchronous-continuation",
"jobConfiguration": "",
"suspended": false,
"overridingJobPriority": 15,
"tenantId": null
},
{
"id": "aJobDefId",
"processDefinitionId": "aProcDefId",
"processDefinitionKey": "aProcDefKey",
"activityId": "ServiceTask2",
"jobType": "asynchronous-continuation",
"jobConfiguration": "",
"suspended": true,
"overridingJobPriority": null,
"tenantId": null
}
]
原文: https://docs.camunda.org/manual/7.9/reference/rest/job-definition/post-query/