FRAMES | NO FRAMES Description | Parameters | Examples | Response
Execute GP Task (Operation)
URL http://<task-url>/execute
Parent Resource Task

Description

The execute operation is performed on a GP task resource for GP services when the execution type is synchronous. The result of this operation is a GP result resource. This resource contains an array of result parameters and the GP task execution messages. Each result parameter provides information such as the parameter name, the data type, and most importantly, the value for that parameter.

The information provided by each result parameter is identical to the information provided by the result parameter resource. Based on the data type of the parameter, the values provide different types of information. Given this fact, the value has different structures based on the data type. Details about values for every data type are included with the result parameter resource.

You can provide arguments to the execute operation as query parameters. These parameters include the input parameters accepted by this service and their corresponding values. The input values for the execute operation are identical to the input values for the submit job operation. Addtionally, you can specify environment parameters such as the output spatial reference and the process spatial reference.

Parameters

Parameter Details
f Description: The response format. The default response format is html. Support for f=amf was added at 10.

Values: html | json | kmz | amf
<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 job operation.
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 the env:outSR is not specified, the output geometries are in the spatial reference of the input geometries. If env:processSR is specified and env:outSR is not specified, the output geometries are in the spatial reference of the process spatial reference.
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:processSR is specified and env:outSR is not specified, the output geometries are in the spatial reference of the process spatial reference.

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 executing. 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 in the submit job operation.

Example 1: Execute the Message In A Bottle task originating at lat-long [0, 0] for 50 days:

http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_Currents_World/GPServer/MessageInABottle/execute?
Input_Point={"features":[{"geometry":{"x":0,"y":0}}]}&
Days=50

Example 2: Execute the task similar to Example 1 but request the output spatial reference to be Web Mercator (102113):

http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_Currents_World/GPServer/MessageInABottle/execute?
Input_Point={"features":[{"geometry":{"x":0,"y":0}}]}&
Days=50&
env:outSR=102113

JSON Response Syntax

{
"results" : [
{
"paramName" : "<paramName1>",
"dataType" : "<dataType1>",
"value" :
<valueLiteralOrObject1>
},
{
"paramName" : "<paramName2>",
"dataType" : "<dataType2>",
"value" : <valueLiteralOrObject2>
}
],
"messages" : [
{"type" : "<type1>", "description" : "<description1>"},
{"type" : "<type2>", "description" : "<description2>"}
]
}

JSON Response Example

{
"results" : [
{
"paramName" : "Output_String",
"dataType" : "GPString",
"value" : "Test String"
},
{
"paramName" : "Output_Double",
"dataType" : "GPDouble",
"value" : 545.64
},
{
"paramName" : "Output_Linear_Unit",
"dataType" : "GPLinearUnit",
"value" : { "distance" : 123.45, "units" : "esriKilometers" }
}
],
"messages" : [
{"type" : "esriJobMessageTypeInformative", "description" : "Executing (TestTask)"},
{"type" : "esriJobMessageTypeInformative", "description" : "Start Time: Thu Jul 05 16:36:25 2007"},
{"type" : "esriJobMessageTypeInformative", "description" : "Executing Copy Features..."},
{"type" : "esriJobMessageTypeInformative", "description" : "Start Time: Thu Jul 05 16:36:25 2007"},
{"type" : "esriJobMessageTypeInformative", "description" : "Executed (Copy Features) successfully."},
{"type" : "esriJobMessageTypeInformative", "description" : "End Time: Thu Jul 05 16:36:26 2007 (Elapsed Time: 1.00 seconds)"},
{"type" : "esriJobMessageTypeInformative", "description" : "Executed (TestTask) successfully."},
{"type" : "esriJobMessageTypeInformative", "description" : "End Time: Thu Jul 05 16:36:26 2007 (Elapsed Time: 1.00 seconds)"}
]
}