FRAMES | NO FRAMES Description | Parameters | Examples | Response
Add Features (Operation)

This is an archive of a previous version of the ArcGIS REST API. The current version can be found at http://resources.arcgis.com/en/help/arcgis-rest-api/

URL http://<featurelayer-url>/addFeatures (POST only)
Parent Resource Layer

Description

This operation adds features to the associated feature layer or table (POST only). The add features operation is performed on a feature service layer resource. The result of this operation is an array of edit results. Each edit result identifies a single feature and indicates if the edit were successful or not. If not, it also includes an error code and an error description.

You can provide arguments to the query operation as query parameters defined in the parameters table below.

Parameters

Parameter Details
f Description: The response format. The default response format is html.

Values: html | json
features Description: The array of features to be added. The structure of each feature in the array is same as the structure of the json feature object returned by the ArcGIS REST API.

Features to be added to a feature layer should include the geometry.

Records to be added to a table should not include the geometry.

Syntax: Example:
[
  {
    "geometry" : {"x" : -118.15, "y" : 33.80},  
    "attributes" : {
      "OWNER" : "Joe Smith",
      "VALUE" : 94820.37,
      "APPROVED" : true,
      "LASTUPDATE" : 1227663551096
    }
  },
  {
    "geometry" : { "x" : -118.37, "y" : 34.086 },  
    "attributes" : {
      "OWNER" : "John Doe",
      "VALUE" : 17325.90,
      "APPROVED" : false,
      "LASTUPDATE" : 1227628579430
    }
  }
]

Example Usage

Example 1: Add a point feature

Click on the following link: http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0/addFeatures

Copy and paste the following feature array in features and click Add Features:

[
    {
      "attributes" : {
        "req_id" : "508389",
        "req_type" : "Graffiti Complaint - Public Property",
        "req_date" : "09\/19\/2009",
        "req_time" : "18:44",
        "address" : "11TH ST and HARRISON ST",
        "x_coord" : "6008925.0",
        "y_coord" : "2108713.8",
        "district" : "6",
        "status" : 1
      },
      "geometry" : {
        "x" : -122.41247978999991,
        "y" : 37.770630098000083
      }
    }
]

JSON Response Syntax

{
  "addResults" : [
    {
      "objectId" : <objectId1>,
      "globalId" : <globalId1>,
      "success" : <true | false>,
      "error" : { //only if success is false
        "code" : <code1>,
        "description" : "<description1>",
      }
    },
    {
      "objectId" : <objectId2>,
      "globalId" : <globalId2>,
      "success" : <true | false>,
      "error" : { //only if success is false
        "code" : <code2>,
        "description" : "<description2>",
      }
    }
  ]
}

JSON Response Example

{
  "addResults" : [
    {
      "objectId" : 37,
      "globalId" : null,
      "success" : true
    },
    {
      "objectId" : -1,
      "globalId" : null,
      "success" : false,
      "error" : {
        "code" : 50,
        "description" : "Cannot add unapproved parcels.",
      }
    }
  ]
}