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

<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

Description: The spatial reference of the output geometries.

The spatial reference can be specified as either a well-known ID or as a spatial reference json object.

If env:outSR is not specified, the output geometries are in the spatial reference of the input geometries. If env:outSR is not specified and env:processSR is specified, it is in the spatial reference of the process spatial reference. For a list of valid WKID values, see Projected coordinate Systems and Geographic coordinate Systems.

env:processSR

Description: 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 env:outSR is not specified, and if env: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.

returnZ

//This option was added at 10.1.

Description: If true, Z values will be 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 will be included in the results if the features have M values. Otherwise M values are not returned. The default is false.

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. Note that the GP execute and submit job operations share the same syntax for all input parameter types and examples of all input parameter types are discussed below.

Example 1: Submit a job to the ERGByChemical task:

http://sampleserver2.arcgisonline.com/ArcGIS/rest/services/PublicSafety/EMModels/GPServer/ERGByChemical/submitJob?Incident_Point={ "features" : [{ "geometry" : {"x" : -104.44, "y" : 34.83}, "attributes" : {"Id" : 43, "Name" : "Incident"}}]} &Material_Type=&Wind_Bearing__direction_blowing_to__0_-_360_=&Day_or_Night_incident=&Large_or_Small_spill=&env:outSR=&env:processSR=&f=html

Example 2: Submit a job to the task similar to Example 1, but request the output spatial reference to be Web Mercator (102100):

http://sampleserver2.arcgisonline.com/ArcGIS/rest/services/PublicSafety/EMModels/GPServer/ERGByChemical/submitJob?Incident_Point={ "features" : [{ "geometry" : {"x" : -104.44, "y" : 34.83}, "attributes" : {"Id" : 43, "Name" : "Incident"}}]} &Material_Type=&Wind_Bearing__direction_blowing_to__0_-_360_=&Day_or_Night_incident=&Large_or_Small_spill=&env:outSR=102100&env:processSR=&f=html

JSON Response Syntax and Example

See the JSON Response Syntax and Examples for the GP job resource.

Input Parameter Values

As discussed above, the values provided for the input parameters are dependent on the data type of the parameter. The following examples 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 either the field url or fields geometryType, hasZ, hasM, spatialReference, fields and features.

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

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

GPFeatureRecordSetLayer that contain geometry with z and/or m values must include hasZ and hasM properties at the featureset 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, spatial reference and fields match the default value, the input GPFeatureRecordSetLayer can exclude geometryType, spatialReference and fields information. The values for geometryType, spatialReference, and fields default to the default value if not 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 and hasM properties for featuresets that contain Z and/or M values. Here is an example that 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:

For "schema-less" input features, those feature sets where 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 featureset to override the default schema:

{ "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 the spatialReference is not specified, it is defaulted 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 like MapService query that returns a JSON featureset.

{ "url" : "http://myserver/myfeatures/afile.txt" }

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

NoteNote:

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

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

From 10.1 onwards for GP Services that support uploads, you can specify an uploaded item as input to GPDataFile as shown below:

{"itemID" : "<itemID>" }

GPRasterData and GPRasterDataLayer

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

  • "url": URL to the location of the input raster data file.
  • "format": the format of the raster data such as "jpg", "tif", etc.

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

From 10.1 onwards for GP Services that support uploads, you can specify an uploaded item as input to GPRasterData as shown below:

{"itemID" : "<itemID>" }

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 ex. GPMultiValue:GPString, GPMultiValue:GPLong, etc.

NoteNote:

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

From 10.1 onwards, all GP data types will be supported in a 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" }
]