Execute GP 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. Additionally, you can specify environment parameters such as the output spatial reference and the process spatial reference.

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

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 executing. 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",
      "dataType" : "GPFeatureRecordSetLayer",
      "value" : {
        "geometryType" : "esriGeometryPolyline",
        "spatialReference" : {
          "wkid" : 102113
        },
        "features" : [
          {
            "attributes" : {
              "FID" : 1,
              "FNODE_" : 0,
              "Shape_Length" : 1978374.8698808267
            },
            "geometry" : {
              "paths" : [
                [
                  [
                    0,
                    0
                  ],
                  [
                    -108217.97210000083,
                    26094.129900000989
                  ],
                  [
                    -217996.3478000015,
                    44553.482400000095
                  ],
                  [
                    -329200.10810000077,
                    49628.166999999434
                  ],
                  [
                    -433777.05680000037,
                    87783.983500000089
                  ],
                  [
                    -534112.75899999961,
                    136007.38540000096
                  ],
                  [
                    -643737.89559999853,
                    155360.90810000151
                  ],
                  [
                    -755033.3936999999,
                    153047.74670000002
                  ],
                  [
                    -866085.40799999982,
                    145333.35249999911
                  ],
                  [
                    -976217.62999999896,
                    129114.93939999864
                  ],
                  [
                    -1087511.3233000003,
                    126718.78040000051
                  ],
                  [
                    -1198617.1088999994,
                    119823.3104000017
                  ],
                  [
                    -1305317.4675999992,
                    88084.511799998581
                  ],
                  [
                    -1411935.6565000005,
                    56073.440000001341
                  ],
                  [
                    -1518314.0241999999,
                    23275.155000001192
                  ],
                  [
                    -1626332.2846999988,
                    -3633.6050999984145
                  ],
                  [
                    -1736260.3031000011,
                    -21179.790600001812
                  ],
                  [
                    -1847319.2710000016,
                    -13568.72899999842
                  ],
                  [
                    -1922858.3764999993,
                    27404.295000001788
                  ]
                ]
              ]
            }
          }
        ],
        "exceededTransferLimit" : false
      }
    }
  ],
  "messages" : [
    
  ]
}