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:

sortByMandatory. Sort the results lexicographically by a given criterion. Valid values are jobDefinitionId, activityId, processDefinitionId, processDefinitionKey, jobType, jobConfiguration and tenantId.
sortOrderMandatory. 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:

  1. {
  2. "activityIdIn":
  3. [
  4. ServiceTask1, ServiceTask2
  5. ],
  6. "sorting":
  7. [{"sortBy": "activityId",
  8. "sortOrder": "asc"
  9. },
  10. {"sortBy": "jobType",
  11. "sortOrder": "asc"
  12. }]
  13. }

Response

  1. [
  2. {
  3. "id": "aJobDefId",
  4. "processDefinitionId": "aProcDefId",
  5. "processDefinitionKey": "aProcDefKey",
  6. "activityId": "ServiceTask1",
  7. "jobType": "asynchronous-continuation",
  8. "jobConfiguration": "",
  9. "suspended": false,
  10. "overridingJobPriority": 15,
  11. "tenantId": null
  12. },
  13. {
  14. "id": "aJobDefId",
  15. "processDefinitionId": "aProcDefId",
  16. "processDefinitionKey": "aProcDefKey",
  17. "activityId": "ServiceTask2",
  18. "jobType": "asynchronous-continuation",
  19. "jobConfiguration": "",
  20. "suspended": true,
  21. "overridingJobPriority": null,
  22. "tenantId": null
  23. }
  24. ]

原文: https://docs.camunda.org/manual/7.9/reference/rest/job-definition/post-query/