FRAMES | NO FRAMES | Description | Parameters | Examples | Response |
URL | http://<featurelayer-url>/applyEdits (POST only) |
Parent Resource | Layer |
---|
This operation adds, updates and deletes features to the associated feature layer or table in a single call (POST only). The apply edits operation is performed on a feature service layer resource. The results of this operation are 3 arrays of edit results (for adds, updates, and deletes respectively). Each edit result identifies a single feature and indicates if the edits were successful or not. If not, it also includes an error code and an error description.
You can provide arguments to the Apply Edits operation as query parameters defined in the parameters table below.
Parameter | Details |
---|---|
f | Description: The
response format. The default response format is html. Values: html | json | pjson |
adds |
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.
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: [ <feature1>, <feature2> ] [ { "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 } } ] |
updates |
Description: The array of features to be updated. The structure of each feature in the array is
same as the structure of the json feature object.
The attributes property of the feature should include the object id of the feature along with the other attributes: "attributes" : { "OBJECTID" : 37, "OWNER" : "Joe Smith", "VALUE" : 94820.37, "APPROVED" : true }Features to be updated to a feature layer should include the geometry. Records to be added to a table should not include the geometry. Syntax: [ <feature1>, <feature2> ] [ { "geometry" : {"x" : -118.15, "y" : 33.80}, "attributes" : { "OBJECTID" : 37, "OWNER" : "Joe Smith", "VALUE" : 94820.37, "APPROVED" : true } }, { "geometry" : { "x" : -118.37, "y" : 34.086 }, "attributes" : { "OBJECTID" : 462, "OWNER" : "John Doe", "VALUE" : 17325.90, "APPROVED" : false } } ] |
deletes |
Description:
The object IDs of this layer / table to be deleted.
Syntax: deletes=<objectId1>, <objectId2>
Example: deletes=37, 462
|
rollbackOnFailure |
Description: Optional parameter to specify if the edits should be applied only if all submitted edits succeed. If false, server will keep the edits that succeed even if some of the submitted edits fail. If true, server will keep the edits only if all edits succeed. Default value is false. Syntax: rollbackOnFailure=true|false
Example: rollbackOnFailure=true
|
Example 1: Add an array of features using the apply edits operation on a feature service layer resource http://sampleserver10.arcgisonline.com/arcgis/rest/services/Utilities/FeatureServer/0/applyEdits
sample input for adds, represented by an array of features:
[ { "attributes" : { "objectid": 123 "req_id" : "5043" "req_type" : "Graffiti Complaint - Public Property", "req_date" : "09\/19\/2009", "req_time" : "18:44", "address" : "11TH ST and HARRISON ST", "status" : 1 }, "geometry" : { "x" : -122.4124, "y" : 37.34063 } } ]
Example 2: Update an array of features using the apply edits operation on a feature service layer resource http://sampleserver10.arcgisonline.com/arcgis/rest/services/Utilities/FeatureServer/0/applyEdits
sample input for updates, represented by an array of features::
[ { "attributes" : { "objectid": 1234567 "req_type" : "Graffiti Complaint - Private Property", "req_time" : "11:24", "address" : "12TH ST and HARDING ST", }, "geometry" : { "x" : -122.41332, "y" : 37.77123 } } ]
{ "addResults" : [ { "objectId" : <objectId1>, "success" : <true | false>, "error" : { //only if success is false "code" : <code1>, "description" : "<description1>", } }, { "objectId" : <objectId2>, "success" : <true | false>, "error" : { //only if success is false "code" : <code2>, "description" : "<description2>", } } ], "updateResults" : [ { "objectId" : <objectId1>, "success" : <true | false>, "error" : { //only if success is false "code" : <code1>, "description" : "<description1>", } }, { "objectId" : <objectId2>, "success" : <true | false>, "error" : { //only if success is false "code" : <code2>, "description" : "<description2>", } } ], "deleteResults" : [ { "objectId" : <objectId1>, "success" : <true | false>, "error" : { //only if success is false "code" : <code1>, "description" : "<description1>", } }, { "objectId" : <objectId2>, "success" : <true | false>, "error" : { //only if success is false "code" : <code2>, "description" : "<description2>", } } ] }
{ "addResults" : [ { "objectId" : 37, "success" : true }, { "objectId" : 456, "success" : false, "error" : { "code": 1007, "description" : "The specified feature could not be inserted." } } ], "updateResults" : [ { "objectId" : 463, "success" : true }, { "objectId" : 462, "success" : false, "error" : { "code" : 1006, "description" : "The specified feature could not be updated or does not exist." } } ], "deleteResults" : [ { "objectId" : "45", "success" : true }, { "objectId" : "57", "success" : false, "error" : { "code" : 1005, "description" : "The specified feature could not be deleted or does not exist." } } ] }