GP Task
- URL:https://<gpservice-url>/<taskName>
- Operations:Execute Task, Submit Job
- Child Resources:Job
- Version Introduced:9.3
Description
The GP Task resource represents a single task in a geoprocessing service published using ArcGIS Server. It provides basic information about the task including its name and display name. It also provides detailed information about the various input and output parameters exposed by the task.
GP Task supports the following two operations:
- submitJobâUse for asynchronous tasks. Asynchronous means that your application does not wait for the task to finish execution, and the end user can continue using the application.
- executeâUse for synchronous tasks. Synchronous means that the application waits while the tool executes on the server. Because the end user must wait, you should determine whether the wait time is acceptable for the type of application.
Child resources
At 10.9.1, a new child resource is available as metadata. It shows the metadata for a GP Task resource, in XML format only. No request parameter is needed. An example usage is to access the metadata using the URL https://myserver.com/serverWebAdaptor/rest/services/myServiceName/GPServer/MyTaskName/metadata.
Request parameters
Parameter |
Details |
---|---|
f |
The response format. The default response format is html. Values: html | json |
Example usage
- URL for the CreateDriveTimePolygons task for ESRI_DriveTime_US on sampleserver1: https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Network/ESRI_DriveTime_US/GPServer/CreateDriveTimePolygons
- URL for the 911 call hot spot analysis on sampleserver6 with a JSON return format: https://sampleserver6.arcgisonline.com/arcgis/rest/services/911CallsHotspot/GPServer/911%20Calls%20Hotspot?f=json
JSON Response syntax
The filter property was added to the JSON response at ArcGIS Server 10.7. The syntax of a parameter with a range filter is shown as the third parameter below.
{
"name": "<taskName>",
"displayName": "<displayName>",
"description": "<description>",
"category": "<category>",
"helpUrl": "<url>",
"executionType": "<esriExecutionTypeAsynchronous | esriExecutionTypeSynchronous>",
"parameters": [
{
"name": "<paramName1>",
"dataType": "<dataType1>",
"displayName": "<displayName1>",
"description": "<description 1>",
"direction": "<direction1>",
"defaultValue": {
<defaultValue1>
},
"parameterType": "<parameterType1>",
"category": "<paramCategory1>",
"choiceList": [
"choice11",
"choice12"
]
},
{
"name": "<paramName2>",
"dataType": "<GPFeatureRecordSetLayer | GPRecordSet>",
"displayName": "<displayName2>",
"description": "<description 2>",
"direction": "<direction2>",
"defaultValue": {
"geometryType": "<geometryType2>",
"hasZ": <true|false>,
"hasM": <true|false>,
"spatialReference": {
<spatialReference>
},
"fields": [
{
"name": "<fieldName21>",
"type": "<fieldType21>"
},
{
"name": "<fieldName22>",
"type": "<fieldType22>"
}
]
},
"parameterType": "<parameterType2>",
"category": "<paramCategory2>",
"choiceList": [
"choice21",
"choice22"
]
},
{
"name": "<paramName3>",
"dataType": "<dataType3>",
"displayName": "<displayName3>",
"description": "<description 3>",
"direction": "<direction1>",
"filter": {
"type": "range",
"minimum": <minimum value of the range>,
"maximum": <maximum value of the range>
},
"defaultValue": {
<defaultValue3>
},
"parameterType": "<parameterType3>",
"category": "<paramCategory3>"
}
]
}
JSON Response example
{
"name": "BufferPoints",
"displayName": "BufferPoints",
"category": "",
"helpUrl": "https://flame7/arcgisoutput/BufferByVal/BufferPoints.htm",
"executionType": "esriExecutionTypeAsynchronous",
"parameters": [
{
"name": "Input_Points",
"dataType": "GPFeatureRecordSetLayer",
"displayName": "Input Points",
"direction": "esriGPParameterDirectionInput",
"defaultValue": {
"geometryType": "esriGeometryPoint",
"hasZ": true,
"spatialReference": {
"wkid": 4326
},
"fields": [
{
"name": "FID",
"type": "esriFieldTypeOID"
},
{
"name": "Shape",
"type": "esriFieldTypeGeometry"
},
{
"name": "Id",
"type": "esriFieldTypeInteger"
}
]
},
"parameterType": "esriGPParameterTypeRequired",
"category": "",
"choiceList": []
},
{
"name": "Distance",
"dataType": "GPLinearUnit",
"displayName": "Distance",
"direction": "esriGPParameterDirectionInput",
"defaultValue": {
"distance": 100.0,
"units": "esriMiles"
},
"parameterType": "esriGPParameterTypeRequired",
"category": "",
"choiceList": []
},
{
"name": "Input_Points_By_Ref",
"dataType": "GPString",
"displayName": "Input Points By Ref",
"direction": "esriGPParameterDirectionInput",
"defaultValue": "fourptsinacol",
"parameterType": "esriGPParameterTypeRequired",
"category": "",
"choiceList": [
"fourptsinacol",
"fourptsinarow",
"partiallines",
"line_shp",
"partialpolys",
"polygon_shp"
]
},
{
"name": "Output_Buffered_Points",
"dataType": "GPFeatureRecordSetLayer",
"displayName": "Output Buffered Points",
"direction": "esriGPParameterDirectionOutput",
"defaultValue": {
"geometryType": "esriGeometryPoint",
"hasZ": true,
"spatialReference": {
"wkid": 4326
},
"fields": [
{
"name": "FID",
"type": "esriFieldTypeOID"
},
{
"name": "Shape",
"type": "esriFieldTypeGeometry"
},
{
"name": "Id",
"type": "esriFieldTypeInteger"
} {
"name": "Name",
"type": "esriFieldTypeString"
}
]
},
"parameterType": "esriGPParameterTypeRequired",
"category": "",
"choiceList": []
}
]
}