Results returned from feature service edit operations

Overview

This topic discusses the edit results returned by the REST API for Feature Service edit operations.

Edit results contain feedback information about edits that have been submitted to a Feature Service using one of the edit operations (including Apply Edits, Update Features, Add Attachment, and Synchronize Replica).

In the response, edit results are grouped by the type edit. They are grouped into either addResults, updateResults, deleteResults, addAttachmentResults, updateAttachmentResults, or DeleteAttachmentResults. Edit Results contain arrays of edit result objects. Each edit result identifies a single feature and indicates if the edit was successful or not. If the edit is not successful, the edit result also includes an error code and an error description.

There are three basic categories of errors that can be reported:

  • Errors that report invalid JSON syntax.
  • Errors that report violations of properties of feature service, such as ownership-based access control settings or editing capabilities. For example, attempting to delete a feature, where the delete capability is not enabled on the feature service (as identified in the capabilities property of the feature service). Another example could be attempting to update a geometry, when this is not permitted (as identified in the allowGeometryUpdates property of the feature service).
  • Errors that are returned directly from the database: For example, a particular update violates a unique constraint on a field in the database.

The first two types of errors (violations of either JSON syntax or properties of the feature service) will be filtered out prior to sending the edit request to the server.

JSON Syntax

"addResults" : [ <editResult1>, <editResult2> ],
  "updateResults" : [ <editResult1>, <editResult2> ],
  "deleteResults" : [ <editResult1>, <editResult2> ]

JSON Example

{
 "addResults": [
  {
   "objectId": 618,
   "success": true
  },
  {
   "success": false,
   "error": {
    "code": -2147217395,
    "description": "Setting of Value for depth failed."
   }
  }
 ],
 "updateResults": [
  {
   "objectId": 50,
   "success": true
  }
 ],
 "deleteResults": [
  {
   "objectId": 25,
   "success": true
  },
  {
   "objectId": 26,
   "success": true
  }
 ]
}