Query (GP Service Jobs)

URL:
https://<root>/services/<folderName>/<ServiceName>.<ServiceType>/jobs/query
Methods:
GET
Required Capability:
Access allowed with either the "Feature layer" or "Geoprocessing" privileges, or the Publisher role
Version Introduced:
10.9.1

Description

The query operation allows you to query jobs pertaining to a geoprocessing service, using a combination of the following parameters:

Request parameters

ParameterDetails

startTime

(Optional)

The earliest time to query. Time is specified in milliseconds from epoch.

Example
Use dark colors for code blocksCopy
1
startTime=1637004590

endTime

(Optional)

The most recent time to query. If unspecified, the current time will be used. If you specify a value for this parameter, you must also specify a startTime value.

Example
Use dark colors for code blocksCopy
1
endTime=1637004594

jobStatus

(Required)

The current status of a job. The value set with this parameter will be used to filter the jobs by that set job status.

Values: esriJobNew | esriJobSubmitted | esriJobExecuting | esriJobSucceeded | esriJobFailed | esriJobCancelling | esriJobCancelled | esriJobWaiting

userName

(Optional)

The name of the user who submitted the job.

Example
Use dark colors for code blocksCopy
1
userName=serviceAdmin

number

(Optional)

The number of jobs to display in the response. The default value is 10.

Example
Use dark colors for code blocksCopy
1
number=10

f

The response format. The default format is html.

Values: html | json | pjson

Response properties

PropertyDetails

total

The total number of jobs found by the query.

query

The parameter specified by your query, including the serviceName of the service being queried.

num

The number of jobs returned on each result page.

start

The order number of the job with which the response begins.

nextStart

The order number of the job that will be the first response on the next results page if the query returns more responses than the value specified for the number parameter. This property is intended to be used as the start value in your next JSON request. When there are no additional jobs to display past the current response, this property will be -1.

results

The jobs found by the query matching your specifications. This returns the jobID and current status of the job.

Example usage

The following is a sample request URL for the query operation:

Use dark colors for code blocksCopy
1
https://organization.domain.com/context/admin/services/System/PublishingTools.GPServer/jobs/query?startTime=&endTime=&jobStatus=esriJobSucceeded&userName=&number=10&f=pjson

JSON Response example

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
  "total": 41,
  "query": {
    "serviceName": "PublishingTools",
    "userName": "",
    "status": ["esriJobSucceeded"]
  },
  "num": 10,
  "start": 1,
  "nextStart": 11,
  "results": {
    "j0550714f334d4114af9f7a5d05cb145e": "Succeeded",
    "j6123787782ba45f7a65d215630fe931b": "Succeeded",
    "j9bbbb5e272e946fdaf844e86cc6d513a": "Succeeded",
    "j4f0095e5b9a145aeb3783050d2b04fe0": "Succeeded",
    "j73318a2d534c4241b53559068ababdba": "Succeeded",
    "j52db3d9281f84038aafed219ef8a94ca": "Succeeded",
    "j42e60c06389b4b7295ea21490e92bc74": "Succeeded",
    "j8c18f527a1d34b40b0e8fa7cb271e176": "Succeeded",
    "j8420a05a6faf4bce971b6f621f69881c": "Succeeded",
    "j5c501b3c20fb49f585dfe1b3a29ce641": "Succeeded"
  }
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.