Submit GP Job
- URL:https://<task-url>/submitJob
- Version Introduced:9.3
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 |
---|---|
<gpParameter1>, <gpParameter2>, ... | 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 | Legacy: This parameter was deprecated at 10.6.1. See the context parameter below. |
env:processSR | Legacy: This parameter was deprecated at 10.6.1. See the context parameter below. |
context | Added at 10.6.1. The context of the service can be specified. Currently, context supports outSR, processSR, and extent. The outSR property is the spatial reference of the output geometries. The processSR property 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 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. For more information, see Using spatial references. 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 | Added at 10.5. If true, true curves will be returned in the results if the features have curves. The default is false. Note: The geojson output format does not support curves. The combination of f as geojson and returnTrueCurves as true should not be used. Values: true | false |
f |
The response format. The default response format is html. Support for amf was added at 10.0 and removed at 10.7. Support for geojson was added at 10.5. Values: html | json | kmz | geojson | amf (deprecated at 10.7) |
Input parameters
Learn more about the syntax and examples of supported input GP data types. For the output_feature_service_name parameter, see the last section.
GET request example usage
With this operation, the majority of the parameters that you include in a 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 1: Submit a job
Submit a job to the ERGByChemical task.
https://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=htmlExample 2: Request a different output spatial reference
Submit a job to the task similar to Example 1 but request that the output spatial reference be Web Mercator (102100).
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://machine.domain.com/webadaptor/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://machine.domain.com/webadaptor/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
Output feature service name
Starting with ArcGIS Enterprise 11, you can overwrite an output feature service when you submit a job.
To overwrite an existing hosted feature service, the user running the web tool must be the owner of that hosted feature service or the ArcGIS Enterprise administrator. This requirement is in addition to all other prerequisites when using the output feature service. To learn more about the prerequisites, see Use web tools with an output feature service. Use the name, the serviceURL, or the itemID of the hosted feature service, to specify which hosted feature service to overwrite. If your existing hosted feature service contains critical information, back up your data, as the overwrite process will delete all existing layers of the hosted feature layer. Whenever possible, use serviceURL or itemID, because they provide the most accurate identification of a hosted feature service. Using a name to identify a hosted feature service may not have an exact match on rare occasions.
To learn more about how to publish a geoprocessing service with this parameter, see Use web tools with an output feature service.
Sample JSON to use an itemID to overwrite an output feature service
{
"itemProperties":
{
"itemId": "52d34e7598e7484188228xxxxxx",
"overwrite": true
}
}
Sample JSON to use a serviceURL to overwrite an output feature service
{
"serviceProperties":
{
"serviceUrl": "https://yourserver.com/server/rest/services/Hosted/FeatureServiceName/FeatureServer"
},
"itemProperties":
{
"overwrite": true
}
}
Sample JSON to use a name to overwrite an output feature service
{
"serviceProperties":
{
"name": "currentfeatureservicename"
},
"itemProperties":
{
"overwrite": true
}
}
In addition, you can also specify the tags, description, and snippet of your new service. The new description and snippet will overwrite all existing descriptions and snippets of your hosted feature service, and your new tags will merge with existing tags.
Sample JSON to overwrite an output feature service with tags, description, and snippet.
{
"itemProperties":
{
"itemId": "52d34e7598e7484188228xxxxxx",
"overwrite": true,
"tags": "a, b, c",
"description": "custom description",
"snippet": "custom snippet"
}
}
You can also set an additional property when submitting a job with the output feature service parameter. For example, your geoprocessing result's spatial reference may differ from the hosted feature service you want to overwrite, or there are temporary issues with your data store. In this case, the overwrite will fail, resulting in a failed geoprocessing service run. However, you can use the newFeatureServiceOnOverwriteFail property to keep your geoprocessing result, especially after a long run. If the overwrite fails, an incrementing number will be appended to the current hosted feature service name, for example, currentname_1. These new hosted feature services will have the new spatial reference from your latest geoprocessing result.
Sample JSON to use the newFeatureServiceOnOverwriteFail property to overwrite an output feature service with an extra attempt.
{
"itemProperties":
{
"itemId": "52d34e7598e7484188228xxxxxx",
"overwrite": true,
"newFeatureServiceOnOverwriteFail": true
}
}