Skip To Content
ArcGIS Developer
Dashboard

Task

Description

A geoprocessing task resource represents a single task in a geoprocessing service published to ArcGIS Server. It provides the task name, display name, and detailed information about various input and output parameters.

A geoprocessing task resource supports the following operations:

  • submitJob—For tasks with asynchronous operation type. An asynchronous type means that the application does not wait for the task to complete, and the end user can continue using the application. A client must actively check the status of the job to learn its progress and results when finished.
  • execute—For tasks with synchronous operation type. A synchronous type means that the application waits while the tool runs on the server. Because the end user must wait, determine whether the wait time is acceptable for the type of application. Fast running analysis is a common use case for synchronous type. However, an output feature service is not available.

Child resources

At 10.9.1, the new metadata child resource is available. It shows the metadata for a geoprocessing task resource in XML format only. No request parameter is needed. An example usage is to access the metadata using the following URL:

Getting the metadata for the MyTaskName task.

https://machine.domain.com/webadaptor/rest/services/myServiceName/GPServer/MyTaskName/metadata
.

Request parameter

ParameterDetails
f

The response format. The default response format is html.

Values: html | json|pjson

Example usage

Example 1: Request URL for the CreateDriveTimePolygons task for ESRI_DriveTime_US.

This request will return the HTML page of the GPTask.

https://machine.domain.com/webadaptor/rest/services/Network/ESRI_DriveTime_US/GPServer/CreateDriveTimePolygons

Example 2: Request URL for the 911 call hot spot analysis with a JSON return format:

This request will return the GPTask with JSON.

https://machine.domain.com/webadaptor/rest/services/911CallsHotspot/GPServer/911%20Calls%20Hotspot?f=json

JSON Response schema

The JSON schema shown below is for a geoprocessing task response when queried with JSON. The filter property is available starting at ArcGIS Server 10.7. The parameterInfos property is available starting at ArcGIS Server 11.0 for the GPValueTable data type.

JSON Schema for a GPTask


{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "JSON Schema for GP Task endpoint",
    "description": "This schema describes the JSON return of a GP Task endpoint. Depending on the version of ArcGIS Server and the original tool, optional keys may not be present.",
    "type": "object",
    "required": [
        "name",
        "displayName",
        "description",
        "category",
        "helpUrl",
        "executionType",
        "parameters"
    ],
    "properties": {
        "name": {
            "description": "The name of the task",
            "type": "string"
        },
        "displayName": {
            "description": "The display name of the task",
            "type": "string"
        },
        "description": {
            "description": "The description of the task",
            "type": "string"
        },
        "category": {
            "description": "The category of the task",
            "type": "string"
        },
        "helpUrl": {
            "description": "The URL containing the metadata of the published tool",
            "type": "string",
            "format": "uri"
        },
        "executionType": {
            "description": "The operation type of the task",
            "type": "string",
            "enum": [
                "esriExecutionTypeAsynchronous",
                "esriExecutionTypeSynchronous"
            ]
        },
        "parameters": {
            "description": "List of parameters of the task",
            "type": "array",
            "items": {
                "description": "Individual parameter",
                "type": "object",
                "required": [
                    "name",
                    "dataType",
                    "displayName",
                    "description",
                    "direction",
                    "defaultValue",
                    "parameterType",
                    "category"
                ],
                "properties": {
                    "name": {
                        "description": "The name of the parameter",
                        "type": "string"
                    },
                    "dataType": {
                        "description": "The data type of the parameter",
                        "type": "string"
                    },
                    "displayName": {
                        "description": "The display name of the parameter",
                        "type": "string"
                    },
                    "description": {
                        "description": "The description of the parameter",
                        "type": "string"
                    },
                    "direction": {
                        "description": "Whether it is an input or an output parameter",
                        "type": "string",
                        "enum": [
                            "esriGPParameterDirectionInput",
                            "esriGPParameterDirectionOutput"
                        ]
                    },
                    "dependency": {
                        "description": "The parameter this one depends on",
                        "type": "string"
                    },
                    "defaultValue": {
                        "description": "The default value of the parameter. The type depends on the possible values of the parameter. It can be null."
                    },
                    "parameterType": {
                        "description": "Whether it is a required or an optional parameter",
                        "type": "string",
                        "enum": [
                            "esriGPParameterTypeRequired",
                            "esriGPParameterTypeOptional",
                            "esriGPParameterTypeDerived"
                        ]
                    },
                    "category": {
                        "description": "The category of the parameter",
                        "type": "string"
                    },
                    "choiceList": {
                        "$ref": "#/definitions/choiceList"
                    },
                    "filter": {
                        "$ref": "#/definitions/filter"
                    },
                    "parameterInfos": {
                        "description": "Information for each column for a GPValueTable parameter. This is not available for all other parameters",
                        "type": "array",
                        "items": {
                            "description": "An individual column",
                            "type": "object",
                            "required": [
                                "name",
                                "dataType",
                                "displayName"
                            ],
                            "properties": {
                                "name": {
                                    "description": "The name of a column",
                                    "type": "string"
                                },
                                "dataType": {
                                    "description": "The data type of a column",
                                    "type": "string"
                                },
                                "displayName": {
                                    "description": "The display name of a column",
                                    "type": "string"
                                },
                                "filter": {
                                    "$ref": "#/definitions/filter"
                                },
                                "choiceList": {
                                    "$ref": "#/definitions/choiceList"
                                }
                            }
                        }
                    }
                }
            },
            "uniqueItems": true
        }
    },
    "definitions": {
        "filter": {
            "description": "For an input with a filter",
            "type": "object",
            "required": [
                "type"
            ],
            "properties": {
                "type": {
                    "description": "The type of filter",
                    "type": "string",
                    "enum": [
                        "range",
                        "featureClass",
                        "file"
                    ]
                },
                "minimum": {
                    "description": "The lower end of a range filter",
                    "type": "number"
                },
                "maximum": {
                    "description": "The upper end of a range filter",
                    "type": "number"
                },
                "list": {
                    "description": "Allowed types of feature classes for a feature class filter, or file extension for a file filter",
                    "type": "array",
                    "items": {
                        "description": "Type of a feature class or a file extension",
                        "type": "string"
                    }
                }
            }
        },
        "choiceList": {
            "description": "For input with a choice list, or a ValueList filter",
            "type": "array",
            "items": {
                "description": "Individual choice on the list",
                "type": "string",
                "uniqueItems": true
            }
        }
    }
}

JSON Response example 1

A sample asynchronous GP task with an input feature parameter with a filter, an output feature parameter, and an automatically added optional input parameter.


{
 "name": "FeatureFiltersLinePolygon",
 "displayName": "Feature filters with line and polygon",
 "description": "This is a feature analysis with input polyline and polygon only. Points are not supported.",
 "category": "",
 "helpUrl": "https://domain/webadaptor/rest/directories/arcgisoutput/Level2_Features_Async_GPServer/Level2_Features_Async/FeatureFiltersLinePolygon.htm",
 "executionType": "esriExecutionTypeAsynchronous",
 "parameters": [
  {
   "name": "Input_Features",
   "dataType": "GPFeatureRecordSetLayer",
   "displayName": "Input Features",
   "description": "line and polygon only",
   "direction": "esriGPParameterDirectionInput",
   "filter": {
    "type": "featureClass",
    "list": [
     "esriGeometryPolygon",
     "esriGeometryPolyline"
    ]
   },
   "defaultValue": {
    "displayFieldName": "",
    "hasZ": true,
    "geometryType": "esriGeometryPolygon",
    "spatialReference": {
     "wkid": 102100,
     "latestWkid": 3857
    },
    "fields": [
     {
      "name": "OBJECTID",
      "type": "esriFieldTypeOID",
      "alias": "OBJECTID"
     },
     {
      "name": "countshort",
      "type": "esriFieldTypeSmallInteger",
      "alias": "countshort"
     },
     {
      "name": "geom",
      "type": "esriFieldTypeSingle",
      "alias": "geom"
     },
     {
      "name": "Shape_Length",
      "type": "esriFieldTypeDouble",
      "alias": "Shape_Length"
     },
     {
      "name": "Shape_Area",
      "type": "esriFieldTypeDouble",
      "alias": "Shape_Area"
     }
    ],
    "features": [],
    "exceededTransferLimit": false
   },
   "parameterType": "esriGPParameterTypeRequired",
   "category": ""
  },
  {
   "name": "Output_Feature_Class",
   "dataType": "GPFeatureRecordSetLayer",
   "displayName": "Output Feature Class",
   "description": "ofc",
   "direction": "esriGPParameterDirectionOutput",
   "defaultValue": {
    "displayFieldName": "",
    "hasZ": true,
    "geometryType": "esriGeometryPoint",
    "spatialReference": {
     "wkid": 102100,
     "latestWkid": 3857
    },
    "fields": [
     {
      "name": "OBJECTID",
      "type": "esriFieldTypeOID",
      "alias": "OBJECTID"
     },
     {
      "name": "countshort",
      "type": "esriFieldTypeSmallInteger",
      "alias": "countshort"
     },
     {
      "name": "geom",
      "type": "esriFieldTypeSingle",
      "alias": "geom"
     },
     {
      "name": "ORIG_FID",
      "type": "esriFieldTypeInteger",
      "alias": "ORIG_FID"
     }
    ],
    "features": [],
    "exceededTransferLimit": false
   },
   "parameterType": "esriGPParameterTypeRequired",
   "category": ""
  },
  {
   "name": "esri_out_feature_service_name",
   "dataType": "GPString",
   "displayName": "Output Feature Service Name",
   "description": "The name of the optional feature service to create on the federated server containing the result of this tool. If no name is specified, an output feature service will not be created.",
   "direction": "esriGPParameterDirectionInput",
   "defaultValue": "",
   "parameterType": "esriGPParameterTypeOptional",
   "category": ""
  }
 ]
}

JSON Response example 2

A sample synchronous GP Task with the GPValueTable parameter, including columns with filters and a GPMultiValue:GPRasterDataLayer output parameter.

{
    "name": "filters",
    "displayName": "Input value table with range filters",
    "description": "This analysis will take a GPValueTable with two columns as an input and generate a multivalue of raster layers as an output",
    "category": "",
    "helpUrl": "https://domain/webadaptor/rest/directories/arcgisoutput/Level2_ValueTable_Sync_GPServer/Level2_ValueTable_Sync/filters.htm",
    "executionType": "esriExecutionTypeSynchronous",
    "parameters": [
        {
            "name": "Input_range_filters",
            "dataType": "GPValueTable",
            "displayName": "Input range filters",
            "description": "long and double are the columnsfirst column long has a range of -99,999 to 99,999 second column double has a range of -12345678.9 to 98765.4321",
            "direction": "esriGPParameterDirectionInput",
            "defaultValue": [
                [
                    567,
                    -56756.567
                ],
                [
                    -6567,
                    67886.678
                ]
            ],
            "parameterType": "esriGPParameterTypeRequired",
            "category": "",
            "parameterInfos": [
                {
                    "name": "input long column",
                    "dataType": "GPLong",
                    "displayName": "input long column",
                    "filter": {
                        "type": "range",
                        "minimum": -99999,
                        "maximum": 99999
                    }
                },
                {
                    "name": "input double column",
                    "dataType": "GPDouble",
                    "displayName": "input double column",
                    "filter": {
                        "type": "range",
                        "minimum": -1.23456789E7,
                        "maximum": 98765.4321
                    }
                }
            ]
        },
        {
            "name": "Output_raster_layers",
            "dataType": "GPMultiValue:GPRasterDataLayer",
            "displayName": "Output raster layers",
            "description": "",
            "direction": "esriGPParameterDirectionOutput",
            "defaultValue": [],
            "parameterType": "esriGPParameterTypeDerived",
            "category": "",
            "parameterInfos": [
                {
                    "name": "Raster Dataset",
                    "dataType": "GPRasterDataLayer",
                    "displayName": "Raster Dataset"
                }
            ]
        }
    ]
}