| FRAMES | NO FRAMES | Description | Parameters | Examples | Response |
| URL | http://<featureservice-url>/applyEdits (POST only) |
Parent Resource | Feature Service |
|---|
This apply edits operation applies edits to features associated with multiple layers or tables in a single call (POST only). This operation is performed on a feature service resource. The result of this operation are arrays of edit results for each layer/table edited. Each edit result identifies a single feature on a layer or table 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 |
| edits |
Description: The array of layers to be edited. 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 or updated to a table should not include geometry. For features that are updated, the attributes property of the feature should include the object id of the feature along with the other attributes. Deletes only need to include the object id of the feature to be deleted. Syntax:
[
{
"id": <layerId1>,
"adds": [
<feature1>,
<feature2>
],
"updates": [
<feature1>,
<feature2>
],
"deletes": [
<objectID1>,
<objectID2>
]
},
{
"id": <layerId2>,
"adds": [
<feature1>,
<feature2>
],
"updates": [
<feature1>,
<feature2>
],
"deletes": [
<objectID1>,
<objectID2>
]
}
]
[
{
"id": 0,
"adds": [
{
"geometry": {
"x": -143.501,
"y": 57.043
},
"attributes": {
"datetime": 1272210710000,
"depth": 31.1,
"region": "Aleutian Islands, Alaska"
}
},
{
"geometry": {
"x": -72.865,
"y": -37.4865
},
"attributes": {
"datetime": 1272210142999,
"depth": "40",
"region": "Bio-Bio, Chile"
}
}
],
"updates": [
{
"geometry": {
"x": -149.450,
"y": 60.120
},
"attributes": {
"OBJECTID": 50,
"datetime": 1272210710000,
"region": "Andreanof Islands, Alaska"
}
}
],
"deletes": [
19,
23
]
},
{
"id": 1,
"deletes": [
34,
44
]
}
]
|
| 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, update, and delete an array of features in multiple layers using the apply edits operation on a feature service resource http://sampleserver10.arcgisonline.com/arcgis/rest/services/Utilities/FeatureServer/applyEdits
Sample input for adds, updates, and deletes on two layers in the feature service:
[
{
"id": 0,
"adds": [
{
"geometry": {
"x": -143.501,
"y": 57.043
},
"attributes": {
"ELEVATION": 1276,
"CITY_NAME": "Chico Island, Alaska"
}
},
{
"geometry": {
"x": -72.86,
"y": -37.4865
},
"attributes": {
"ELEVATION": 406,
"CITY_NAME": "Biola, Chile"
}
}
],
"updates": [
{
"geometry": {
"x": -14.450,
"y": 60.120
},
"attributes": {
"OBJECTID": 50,
"ELEVATION": 127,
"CITY_NAME": "Nowhere, Canada"
}
}
],
"deletes": [
29,
33
]
},
{
"id": 1,
"updates": [
{
"attributes": {
"OBJECTID": 2,
"NAME": "SE Pipe",
"SYSTEM": "Mississippi"
},
"geometry": {
"paths": [
[
[
-106.379458349234,
39.3616515744119
],
[
-98.6178494161113,
38.3472257794714
],
[
-91.0665307961486,
33.7866275201336
]
]
]
}
}
],
"deletes": [
21
]
}
]
[
{
"id": <layerId1>,
"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>"
}
}
],
"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>"
}
}
],
"deleteResults": [
{
"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>"
}
}
]
},
{
"id": <layerId2>,
"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>"
}
}
],
"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>"
}
}
],
"deleteResults": [
{
"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>"
}
}
]
}
]
[
{
"id": 0,
"addResults": [
{
"objectId": 3156,
"globalId": null,
"success": true
},
{
"objectId": 3157,
"globalId": null,
"success": true
}
],
"updateResults": [
{
"objectId": 50,
"globalId": null,
"success": true
}
],
"deleteResults": [
{
"objectId": 29,
"globalId": null,
"success": true
},
{
"objectId": 33,
"globalId": null,
"success": true
}
]
},
{
"id": 1,
"addResults": [
],
"updateResults": [
{
"objectId": 2,
"globalId": null,
"success": true
}
],
"deleteResults": [
{
"objectId": 21,
"globalId": null,
"success": false,
"error": {
"code": 1005,
"description": "The specified feature could not be deleted or does not exist."
}
}
]
}
]