FRAMES | NO FRAMES Description | Parameters | Examples | Response
Delete Features (Operation)
URL http://<featurelayer-url>/deleteFeatures (POST only)
Parent Resource Layer
Required Capability Delete

Description

This operation deletes features in a feature layer or table (POST only). The delete 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 delete 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
objectIds Description: The object IDs of this layer / table to be deleted. Syntax: objectIds=<objectId1>, <objectId2>

Example: objectIds=37, 462
where Description: A where clause for the query filter. Any legal SQL where clause operating on the fields in the layer is allowed. Features conforming to the specified where clause will be deleted.

Example: where=POP2000 > 350000
geometry Description: The geometry to apply as the spatial filter. Features conforming to the spatial relationship (specified using the spatialRel parameter) of this geometry will be deleted. The structure of the geometry is the same as the structure of the json geometry objects returned by the ArcGIS REST API. In addition to the JSON structures, for envelopes and points, you can specify the geometry with a simpler comma-separated syntax.

Syntax:
  • JSON structures: geometryType=<geometryType>&geometry={geometry}
  • Envelope simple syntax: geometryType=esriGeometryEnvelope&geometry=<xmin>,<ymin>,<xmax>,<ymax>
  • Point simple syntax: geometryType=esriGeometryPoint&geometry=<x>,<y>
Examples:
  • geometryType=esriGeometryEnvelope&geometry={xmin: -104, ymin: 35.6, xmax: -94.32, ymax: 41}
  • geometryType=esriGeometryEnvelope&geometry=-104,35.6,-94.32,41
  • geometryType=esriGeometryPoint&geometry=-104,35.6
geometryType Description: The type of geometry specified by the geometry parameter. The geometry type can be an envelope, point, line, or polygon. The default geometry type is an envelope.

Values: esriGeometryPoint | esriGeometryMultipoint | esriGeometryPolyline | esriGeometryPolygon | esriGeometryEnvelope
inSR Description: The spatial reference of the input geometry.

The spatial reference can be specified as either a well-known ID or as a spatial reference json object.

If the inSR is not specified, the geometry is assumed to be in the spatial reference of the map.
spatialRel Description: The spatial relationship to be applied on the input geometry while performing the query. The supported spatial relationships include intersects, contains, envelope intersects, within, etc. The default spatial relationship is intersects (esriSpatialRelIntersects).

Values: esriSpatialRelIntersects | esriSpatialRelContains | esriSpatialRelCrosses | esriSpatialRelEnvelopeIntersects | esriSpatialRelIndexIntersects | esriSpatialRelOverlaps | esriSpatialRelTouches | esriSpatialRelWithin
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>
Example:
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 Usage

Example 1: Delete features using the delete features operation on a feature service layer resource http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0/deleteFeatures

The input to Delete features operation can be a list of objectIds and/or where clause and/or geometry to apply as a spatial filter.

JSON Response Syntax (when objectIds are specified)

{
  "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>",
      }
    }
  ]
}

JSON Response Syntax (when objectIds are not specified)

{ "success" : true }

JSON Response Example

{
   "deleteResults": [
   {
    "objectId": 19,
    "success": true
   },
   {
    "objectId": 23,
    "success": true
   }
  ]
}