Submit GP Job

Description

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

Request parameters

Parameter

Details

f

Description: The response format. The default response format is html.

Values: html | json | kmz | geojson

geojson was added at 10.5.

<gpParameter1>, <gpParameter2>, ...

Description: The various input parameters accepted by the corresponding GP task. The valid values for the input parameters are dependent on the data type of the parameter. These values are discussed in more detail below.

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.

returnZ

This option was added at 10.1.

Description: If true, z-values are included in the results if the features have z-values. Otherwise, z-values are not returned. The default is false.

returnM

This option was added at 10.1.

Description: If true, m-values are included in the results if the features have m-values. Otherwise, m-values are not returned. The default is false.

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.

context

This option was added at 10.6.1.

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

outSR is the spatial reference of the output geometries. The spatial reference can be specified as either a well-known ID (WKID) or a spatial reference JSON object. If outSR is not specified, the output geometries will be in the spatial reference of the input geometries. If outSR is not specified and processSR is specified, the output geometries will be in the spatial reference of the process spatial reference. For a list of valid WKID values, see Projected coordinate systems and Geographic coordinate systems.

processSR is the spatial reference that the model uses to perform geometry operations. The spatial reference can be specified as either a WKID or a spatial reference JSON object. If outSR is not specified and processSR is specified, the output geometries are in the spatial reference of the process spatial reference. For a list of valid WKID values, see Projected coordinate systems and Geographic coordinate systems.

Tasks that have the extent property in their context parameter will only process features that overlap the specified extent. The output features will have an extent that is the same or larger than extent.

NoteNote:

Only tools that honor the Extent environment can process features or rasters that fall within the extent specified in context, once they are published.

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 that you are submitting. The GP execute and submitJob 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

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}}}

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 the 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 in turn 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, where 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 hasZ or hasM properties, respectively, at the feature set level.

GPFeatureRecordSetLayer syntax

{ 
"geometryType" : "<geometryType>",
"hasZ" : <true|false>,  //Added at 10.1
"hasM" : <true|false>,   //Added at 10.1
"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> 
                } 
            }
        ]
}

Example 1

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

In cases where the input geometryType, spatialReference, and fields match the default value, the input GPFeatureRecordSetLayer can exclude geometryType, spatialReference, and fields information. The values for geometryType, spatialReference, and fields use the default value if no other value is 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

Provide hasZ or hasM properties 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

This example is for schema-less input features, such as those feature sets where the geometry type, fields, or spatial reference is not specified by the model publisher, or where 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

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" : "http://myserver/myfeatures/afile.txt" }
{"url":"http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0/query?where=1%3D1&f=json"}

Example 6

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

{ "itemID" : "<itemID>" }

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

LegacyLegacy:

The alternate JSON structure representation specified below has been deprecated at 10.0.

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

  • "date"—A string value representing the date.
  • "format"—A string specifying the format for the date.

{ "date" : "4/6/07", "format" : "M/d/y" } //deprecated at 10

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" : "http://myserver/myfile" }

At 10.1 and later for geoprocessing services that support uploads, you can specify an uploaded item as input to GPDataFile as follows:

{"itemID" : "<itemID>" }

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" : "http://myserver/lake.tif", "format" : "tif" }

At 10.1 and later for geoprocessing services that support uploads, you can specify an uploaded item as input to GPRasterData as follows:

{"itemID" : "<itemID>" }

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

NoteNote:

Support for the GPMultiValue parameter type was added at 10.

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

NoteNote:

At 10.0, only the GPMultiValue:GPString data type is supported.

At 10.1 and later, 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

GPMultiValue:GPString data type:

["Parcels", "Street Lights"]

Example 2

GPMultiValue:GPLinearUnit data type:

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