FRAMES | NO FRAMES | Description | Parameters | Examples | Response |
URL | http://<featurelayer-url>/updateFeatures (POST only) |
Parent Resource | Layer |
---|---|
Required Capability | Update |
This operation updates features in a feature layer or table (POST only). The update 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 edits were successful or not. If not, it also includes an error code and an error description.
You can provide arguments to the Update Features 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 |
features |
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
returned by the ArcGIS REST API.
The attributes property of the feature should include the object id (and the global id, if available) of the feature along with the other attributes: "attributes" : { "OBJECTID" : 37, "OWNER" : "Joe Smith", "VALUE" : 94820.37, "APPROVED" : true, "LASTUPDATE" : 1227667627940 }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, "LASTUPDATE" : 1227667627940 } }, { "geometry" : { "x" : -118.37, "y" : 34.086 }, "attributes" : { "OBJECTID" : 462, "OWNER" : "John Doe", "VALUE" : 17325.90, "APPROVED" : false, "LASTUPDATE" : 9269154204840 } } ] |
gdbVersion |
//This option was added at 10.1 Description: GeoDatabase version to apply the edits. This parameter applies only if isDataVersioned property of the layer is true . If this is not specified, edits are made to published map’s version. Syntax: gdbVersion=<version> gdbVersion=SDE.DEFAULT |
rollbackOnFailure |
//This option was added at 10.1 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. The default value is true. Not all data supports setting this parameter. Query the supportsRollbackonFailureParameter property of the layer to determine whether or not a layer supports setting this parameter. If supportsRollbackonFailureParameter = false for a layer, then when editing this layer, rollbackOnFailure will always be true, regardless of how the parameter is set. However, if supportsRollbackonFailureParameter = true, this means the rollbackOnFailure parameter can be set to true or false on edit operations. Syntax: rollbackOnFailure=true|false
Example: rollbackOnFailure=true
|
Example 1: Update an array of features using the update features operation on a feature service layer resource
http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0/updateFeatures
Sample input array of features:
[ { "attributes" : { "objectid": 1234567, "req_id" : "508389", "req_type" : "Graffiti Complaint - Private 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" : 2 }, "geometry" : { "x" : -122.41247978999991, "y" : 37.770630098000083 } } ]
{ "updateResults" : [ { "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>", } } ] }
{ "updateResults": [ { "objectId": 50, "success": true } ] }