- URL:https://<task-url>/jobs/<job-id>
- Operations:Cancel
- Child Resources:Input, Result
- Version Introduced:9.3
Description
The GP job resource represents a job submitted using the submit job operation. It provides basic information about the job such as the job ID, status, and messages. Additionally, if the job has successfully completed, it provides information about the result parameters as well as the input parameters.
- Job ID, as jobId, is a system assigned id for each job. Each job has a unique ID.
- Status, as jobStatus, is the current status of the job. It can be the following value, esriJobCancelled, esriJobCancelling, esriJobExecuting, esriJobFailed, esriJobNew, esriJobSucceeded, esriJobTimedOut, esriJobSubmitted, esriJobWaiting, expectedFailure.
- Progress, as progress, see the progress messages section below.
- Messages, as messages, you can specify whether you want the messages to be returned by using returnMessages. To configure the message level, see Show Messages.
- Output, as results, if any. All result values can be accessed via the GP result resource. The JSON response specifies a relative URL to the result resource with a paramUrl field.
- Input, as inputs, if any. All input parameter values are accessed via the GP input resource. The JSON response specifies a relative URL to the input resource with a paramUrl field.
The job resource supports a Cancel job operation. This operation can be used to cancel a job before it's completed. If your geoprocessing service is Python code without using any ArcPy functions, the cancellation request will not be fulfilled.
Progress messages
For geoprocessing services published from ArcGIS Pro 2.6 or later to ArcGIS Server 10.8.1 or later, a new section, progress, is added in the response JSON. HTML or kmz response is not supported. The status message is only available when the jobStatus is esriJobExecuting. When the job is in other status, like esriJobSumbitted, or esriJobSucceed, this status message will not be available. The status message will update once every 5 seconds in the REST response JSON. This update frequency cannot be configured now.
This progress message is controlled by using arcpy.SetProgressor and other ArcPy progressor functions when you are authoring a Python script tool. Like the progressor in ArcGIS Pro, there can be only one type of progressor at a time, and there can be only one message associated with that progressor. Some system tools have a progressor set by default. Both the default progressor and the step progressor are supported. For a step progressor, although a range with negative value is supported, using a positive value for range is suggested. In addition to the message, a step progress will also provide the percentage finished for the geoprocessing service. The calculation is based on the position, minimum and maximum of the range. This progress message can provide a performance improvement, if you want to know a frequent status update of a long running geoprocessing service, compared to using arcpy.AddMessage.
If there is no progressor defined in the geoprocessing service, a default progressor will be assigned, with a default progress message as Executing.... A default progressor. This is the default if no progressor is specified. A step progressor.{
"progress": {
"type": "default",
"message": "Executing..."
}
}
{
"progress": {
"type": "step",
"message": "This is a step progressor with minimum 2, maximum 10, step 2",
"percent": 0
}
}
Request parameters
Parameter | Details |
---|---|
f | The response format. The default response format is html. Values: html | json | kmz |
returnMessages | If true, the job messages are included in the response. The default is true. Values: true | false |
Example usage
When you submit a job to the ERGByChemical task as shown in the Submit Job doc's Examples section, and the output format is html(f=html), you'll be redirected to the job resource page whose URL will be similar to the following:
https://sampleserver2.arcgisonline.com/ArcGIS/rest/services/PublicSafety/EMModels/GPServer/ERGByChemical/jobs/jf082fc6d926043fda44169444963fe46
Note:
jf082fc6d926043fda44169444963fe46 is an example job ID, and the job ID for your job will be unique.
JSON response syntax and example
JSON response syntax{
"jobId": "<jobId>",
"jobStatus": "<jobStatus>",
"results": {
"<param1>": {
"paramUrl": "<relativeUrlToParam1>"
},
"<param2>": {
"paramUrl": "<relativeUrlToParam2>"
}
},
"inputs": {
"<param1>": {
"paramUrl": "<relativeUrlToParam1>"
},
"<param2>": {
"paramUrl": "<relativeUrlToParam2>"
}
},
"messages": [
{
"type": "<type1>",
"description": "<description1>"
},
{
"type": "<type2>",
"description": "<description2>"
}
]
}
JSON response example{
"jobId": "JE30155054C2C416EA3CF6C88A40B94FF",
"jobStatus": "esriJobSucceeded",
"results": {
"Output_Long": {
"paramUrl": "results/Output_Long"
},
"Output_Feature_Class": {
"paramUrl": "results/Output_Feature_Class"
}
},
"inputs": {
"Input_String": {
"paramUrl": "inputs/Input_String"
},
"Input_Feature_Class": {
"paramUrl": "inputs/Input_Feature_Class"
}
},
"messages": [
{
"type": "esriJobMessageTypeInformative",
"description": "Executing (TestTask)"
},
{
"type": "esriJobMessageTypeInformative",
"description": "Start Time: Thu Jul 05 16:36:25 2007"
},
{
"type": "esriJobMessageTypeInformative",
"description": "Executing Copy Features..."
},
{
"type": "esriJobMessageTypeInformative",
"description": "Start Time: Thu Jul 05 16:36:25 2007"
},
{
"type": "esriJobMessageTypeInformative",
"description": "Executed (Copy Features) successfully."
},
{
"type": "esriJobMessageTypeInformative",
"description": "End Time: Thu Jul 05 16:36:26 2007 (Elapsed Time: 1.00 seconds)"
},
{
"type": "esriJobMessageTypeInformative",
"description": "Executed (TestTask) successfully."
},
{
"type": "esriJobMessageTypeInformative",
"description": "End Time: Thu Jul 05 16:36:26 2007 (Elapsed Time: 1.00 seconds)"
}
]
}