Submit GP Job

Description

The submitJob operation is performed on an asynchronous geoprocessing task resource. The result of this operation is a geoprocessing job resource. You can provide arguments to the submitJob operation as query parameters defined in the parameters table below.

Request parameters

Parameter

Description

f

Description: The response format. The default response format is html. Support for f=amf was added at 10.0 and removed at 10.7. Support for f=geojson was added at 10.5.

Values: html | json | kmz | geojson

<gpParameter1>, <gpParameter2>, ...

Description: The various input parameters accepted by the corresponding GP task. These parameters are listed in the parameters property of the JSON representation associated with the GP task resource.

The valid values for the input parameters are dependent on the data type of the parameter. These values are discussed in more detail in Submit GP Job.

env:outSR

This option was deprecated at 10.6.1. See the context parameter below.

env:processSR

This option was deprecated at 10.6.1. See the context parameter below.

context

This option was added at 10.6.1.

Description: The context of the service can be specified. Currently, context supports outSR, processSR, and extent.

outSR is the spatial reference of the output geometries.

processSR is the spatial reference that the model will use to perform geometry operations.

The spatial reference can be specified as either a well-known ID or as a spatial reference JSON object. If the outSR is not specified, the output geometries are in the spatial reference of the input geometries. If processSR is specified and outSR is not specified, the output geometries are in the spatial reference of the process spatial reference. If processSR is specified and outSR is not specified, the output geometries are in the spatial reference of the process spatial reference.

extent will only process features that overlap the specified extent. The output features will have an extent that is the same or larger than extent.

returnTrueCurves

This option was added at 10.5.

Description: If true, true curves will be returned in the results if the features have curves. The default is false.

The geojson output format does not support curves. The combination of f=geojson and returnTrueCurves=true should not be used.

GET request example usage

With this operation, the majority of the parameters that you include in your request are dependent on the input parameter types of the geoprocessing task you are submitting. The execute and submitJob geoprocessing operations share the same syntax for all input parameter types, and examples of all input parameter types are discussed in subsequent sections of this topic.

Example 3: Request a processing extent

Submit a job to a geoprocessing task, but request that the extent have xmin 7,602,115, ymin 660,605, xmax 7,619,050, and ymax 676,100, with the extent in spatial reference in NAD 1983 State Plane Oregon North (wkid 102726, feet).

https://server/ServerWebAdaptor/rest/services/ServiceName/GPServer/TaskName/submitJob?input=points&context={extent:{"xmin":7602115,"ymin":660605,"xmax":7619050,"ymax":676100,spatialReference:{"wkid":102726}}}

Example 4: Request an output feature service with input as a hosted feature service layer

https://server/ServerWebAdaptor/rest/services/ServiceName/GPServer/TaskName/submitJob?in_features={"url":"https://sampleserver6.arcgisonline.com/arcgis/rest/services/LocalGovernment/CitizenRequests/FeatureServer/0"}&buffer_distance_or_field={"distance":10,"units":"esriMiles"}&line_side=FULL&line_end_type=ROUND&method=PLANAR&esri_out_feature_service_name=output_requests_hosted_featureservice&f=json

JSON Response syntax and example

See the JSON response syntax and examples in the GP Job resource topic.

Input parameter values

As discussed previously, the values provided for the input parameters are dependent on the data type of the parameter. The examples below show the input parameter syntax based on the parameter data type.

GPBoolean, GPDouble, GPLong, and GPString

For simple data types and the parameter values GPBoolean, GPDouble, GPLong, and GPString, use their literal values.

InputBoolean=true&InputDouble=345.678&InputLong=345&InputString=MyString

GPLinearUnit

The parameter value for GPLinearUnit is a JSON structure with the following fields:

  • distance—A double value
  • units—A string with unit values such as "esriMeters" or "esriMiles"

{
    "distance": 345.678,
    "units": "esriMiles"
}

GPFeatureRecordSetLayer and GPRecordSet

The parameter value for GPFeatureRecordSetLayer is a JSON structure containing the field url or itemID, or the fields geometryType, hasZ, hasM, spatialReference, fields, and features.

The parameter value for GPRecordSet is a JSON structure containing the fields features and fields, the field url, or the field itemID.

The "features" field is an array of features. Each feature contains the following fields:

  • "geometry"—Can be points, lines, or polygons. The structure for the geometries is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API.
  • "attributes"—Key-value pairs in which the key is a field name in the list of fields of the record set, and the value is the value for the corresponding field.

NoteNote:

Values for GPFeatureRecordSetLayer contain the "geometry" field, while values for GPRecordSet do not.

If GPFeatureRecordSetLayer contains geometry with z- or m-values, it must include the hasZ or hasM property, respectively, at the feature set level.

GPFeatureRecordSetLayer syntax

{
    "geometryType": "<geometryType>",
    "hasZ": <true|false>,
    "hasM": <true|false>,
    "spatialReference": {spatialReference
    },
    "fields": [
        {
            "name": "<field1>",
            "type": "<field1Type>",
            "alias": "<field1Alias>"
        },
        {
            "name": "<field2>",
            "type": "<field2Type>",
            "alias": "<field2Alias>"
        }
    ],
    "features": [
        {
            "geometry": {
                        <geometry1>
            },
            "attributes": {
                "<field1>": <value11>,
                "<field2>": <value12>
            }
        },
        {
            "geometry": {
                        <geometry2>
            },
            "attributes": {
                "<field1>": <value21>,
                "<field2>": <value22>
            }
        }
    ]
}

GPRecordSetLayer syntax

{
    "fields": [
        {
            "name": "<field1>",
            "type": "<field1Type>",
            "alias": "<field1Alias>"
        },
        {
            "name": "<field2>",
            "type": "<field2Type>",
            "alias": "<field2Alias>"
        }
    ],
    "features": [
        {
            "attributes": {
                "<field1>": <value11>,
                "<field2>": <value12>
            }
        },
        {
            "attributes": {
                "<field1>": <value21>,
                "<field2>": <value22>
            }
        }
    ]
}

Output feature service name

For some services having a GPFeatureRecordSetLayer or GPRecordSetLayer output, there will be a preserved optional GPString input parameter output feature service name available as shown below.

{
   "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": ""
  }

The name must meet specific requirements, and the request must be made from a user with specific privileges.

URL syntax

To specify a feature service layer or map service layer, provide the URL to the layer. An optional attribute filter can be added. Starting at 10.7.1, instead of querying time-enabled map service layers or time-enabled feature service layers, a time filter can be specified. Time can be filtered as a single instant or by separating the two ends of a time extent with a comma.

{ 
    "url": "<url of a map service or a feature service layer>",
    "filter": <attribute expression>,
    "time": <time value>
}

Item ID syntax

For a large set of geometries, you can also specify an uploaded item as input for geoprocessing services that support uploads.

{
    "itemID" : "<itemID>" 
}

Example 1: Basic

{
    "geometryType": "esriGeometryPoint",
    "spatialReference": {
        "wkid": 4326
    },
    "fields": [
        {
            "name": "Id",
            "type": "esriFieldTypeOID",
            "alias": "Id"
        },
        {
            "name": "Name",
            "type": "esriFieldTypeString",
            "alias": "Name"
        }
    ],
    "features": [
        {
            "geometry": {
                "x": -104.44,
                "y": 34.83
            },
            "attributes": {
                "Id": 43,
                "Name": "Feature 1"
            }
        },
        {
            "geometry": {
                "x": -100.65,
                "y": 33.69
            },
            "attributes": {
                "Id": 67,
                "Name": "Feature 2"
            }
        }
    ]
}

Example 2: Minimum information

In cases where the input geometryType, spatialReference, and fields values match the default values, the input GPFeatureRecordSetLayer can exclude geometryType, spatialReference, and fields information. The geometryType, spatialReference, and fields values will be the default values if no other values are supplied.

{
    "features": [
        {
            "geometry": {
                "x": -104.44,
                "y": 34.83
            },
            "attributes": {
                "Id": 43,
                "Name": "Feature 1"
            }
        },
        {
            "geometry": {
                "x": -100.65,
                "y": 33.69
            },
            "attributes": {
                "Id": 67,
                "Name": "Feature 2"
            }
        }
    ]
}

Example 3: hasZ or hasM

Provide the hasZ or hasM property for feature sets that contain z- or m-values, respectively. The following example has z-values:

{
    "geometryType": "esriGeometryPoint",
    "hasZ": true,
    "spatialReference": {
        "wkid": 4326
    },
    "fields": [
        {
            "name": "Id",
            "type": "esriFieldTypeOID",
            "alias": "Id"
        },
        {
            "name": "Name",
            "type": "esriFieldTypeString",
            "alias": "Name"
        }
    ],
    "features": [
        {
            "geometry": {
                "x": -104.44,
                "y": 34.83,
                "z": 10.0
            },
            "attributes": {
                "Id": 43,
                "Name": "Feature 1"
            }
        },
        {
            "geometry": {
                "x": -100.65,
                "y": 33.69,
                "z": 11.0
            },
            "attributes": {
                "Id": 67,
                "Name": "Feature 2"
            }
        }
    ]
}

Example 4: Schema-less features

This example is for schema-less input features, such as those feature sets in which the geometry type, fields, or spatial reference is not specified by the model publisher, or you must provide the geometry type and the spatial reference in addition to the features as specified below. Similarly, provide a fully defined feature set to override the default schema as follows:

{
    "geometryType": "esriGeometryPoint",
    "spatialReference": {
        "wkid": 4326
    },
    "fields": [
        {
            "name": "Id",
            "type": "esriFieldTypeOID",
            "alias": "Id"
        },
        {
            "name": "Name",
            "type": "esriFieldTypeString",
            "alias": "Name"
        }
    ],
    "features": [
        {
            "geometry": {
                "x": -104.44,
                "y": 34.83
            },
            "attributes": {
                "Id": 43,
                "Name": "Feature 1"
            }
        },
        {
            "geometry": {
                "x": -100.65,
                "y": 33.69
            },
            "attributes": {
                "Id": 67,
                "Name": "Feature 2"
            }
        }
    ]
}

The geometryType can be esriGeometryPoint, esriGeometryPolyline, or esriGeometryPolygon. If the geometry type is not specified, it is assumed to be esriGeometryPoint. If spatialReference is not specified, it defaults to an unknown coordinate system.

Example 5: URL to geometries or feature queries

For a large set of geometries, you can specify a URL to the input geometries stored in a JSON structure in a file on a public server. The URL value can also be a URL to an operation such as a MapService or FeatureService query that returns a JSON feature set.

{
    "url" : "https://myserver/myfeatures/afile.txt"
}
{
    "url":"https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0/query?where=1%3D1&f=json"
}

Example 6: URL of a service with an attribute filter

You can specify the URL of a map service layer or a feature service layer.

Specify the citizen requests layer from a feature service on sampleserver6 without any filter.

{
    "url":"https://sampleserver6.arcgisonline.com/arcgis/rest/services/CommercialDamageAssessment/FeatureServer/0"
}

Filter the citizen requests layer from a map service on sampleserver6, with an attribute filter selecting requests having a level 2 severity and null names.

{
    "url":"https://sampleserver6.arcgisonline.com/arcgis/rest/services/LocalGovernment/CitizenRequests/MapServer/0",
    "filter":"severity=2 and name is null"
}

Example 7: Time filter

Starting at 10.7.1, instead of querying time-enabled map service layers or time-enabled feature service layers, a time filter can be specified. Time can be filtered as a single instant or by separating the two ends of a time extent with a comma.

Specify a single time instant.

{
    "url":"https://myserver/../myservicename/FeatureServer/0",
    "time":967855732000
}

Specify a time extent (including null on either end of the extent).

{
    "url":"https://myserver/../myservicename/FeatureServer/0",
    "time":"967855732000,null"
}

GPDate

The parameter value for GPDate is a number that represents the number of milliseconds since epoch (January 1, 1970) in UTC.

InputDate=1199145600000 // 1 Jan 2008 00:00:00 GMT

GPDataFile

The parameter value for GPDataFile is a JSON structure with a "url" field. The value of the "url" field is a URL to the location of the input data file.

URL Syntax:

{ 
    "url" : "https://myserver/myfile" 
}

For geoprocessing services that support uploads, you can specify an uploaded item as input to GPDataFile as follows:

ArcGIS Server item ID syntax:

{
    "itemID" : "<itemID>" 
}

At 10.8, you can specify a portal item ID as an input when you publish your geoprocessing services to a federated server as follows. To find the ID of a portal item, this blog post describes a similar process for ArcGIS Online.

Portal item ID syntax:

{
    "portalItemID" : "<portalItemID>" 
}

GPRasterData and GPRasterDataLayer

The parameter value for GPRasterData and GPRasterDataLayer data types is a JSON structure with the following fields:

  • "url"—The URL to the location of the input raster data file
  • "format"—The format of the raster data, such as "jpg", "tif", and so on.

{ 
    "url" : "https://myserver/lake.tif", 
    "format" : "tif"
}

For geoprocessing services that support uploads, you can specify an uploaded item as input to GPRasterData as follows:

{
    "itemID" : "<itemID>"
}

At 10.8, a URL to an image service is supported as an input, provided the tool supports image service as an input.

{
    "url": "<url to your image service>"
}

Example

Using the NDFD wind data from sampleserver 6.

{
    "url":"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ScientificData/NDFD_wind/ImageServer"
}

Field

At 10.7 and later, Field is supported as an input and output parameter type. For information about specific requirements to publish a web tool with a Field input, see Input and output parameters.

Field syntax

{
    "name": "<Field name>",
     "type": "<Field type>",
    "alias": "<Field alias>",
    "editable": false | true,
    "nullable": false | true,
    "length": <Field length>
}

Example

{
    "name": "distance",
    "type": "esriFieldTypeInteger",
    "alias": "int",
    "editable": true,
    "nullable": true,
    "length": 4
}

GPMultiValue

The fully qualified data type for the GPMultiValue parameter is GPMultiValue:<memberDataType>, where memberDataType is one of the data types defined above, for example, GPMultiValue:GPString, GPMultiValue:GPLong, and so on. All geoprocessing data types are supported in GPMultiValue.

The parameter value for GPMultiValue data types is a JSON array. Each element in this array is of the data type as defined by the memberDataType suffix of the fully qualified GPMultiValue data type name.

Example 1: Using GPFeatureRecordSetLayer

GPMultiValue:GPFeatureRecordSetLayer data type using 3 local government feature service layers from sampleserver6:

[
    {
        "url": "https://sampleserver6.arcgisonline.com/arcgis/rest/services/LocalGovernment/CatchbasinInspections/FeatureServer/0"
    },
    {
        "url": "https://sampleserver6.arcgisonline.com/arcgis/rest/services/LocalGovernment/CitizenRequests/FeatureServer/0"
    },
    {
        "url": "https://sampleserver6.arcgisonline.com/arcgis/rest/services/LocalGovernment/Events/FeatureServer/0"
    }
]

Example 2: Using GPString

GPMultiValue:GPString data type:

["Parcels", "Street Lights"]

Example 3: Using GPLinearUnit

GPMultiValue:GPLinearUnit data type:

[
    {
        "distance": 345.67,
        "units": "esriMiles"
    },
    {
        "distance": 36,
        "units": "esriMiles"
    }
]