FRAMES | NO FRAMES Description | Parameters | Examples | Response
Delete Attachments (Operation)
URL http://<featureservicefeature-url>/deleteAttachments (POST only)
Parent Resource Feature
Required Capability Update

Description

This operation deletes attachments associated with a feature (POST only). Deleting an attachment is a feature update, it requires the Update capability. The delete attachments operation is performed on a feature service feature resource.

This operation is available only if the layer has advertised that it has attachments. A layer has attachments if its hasAttachments property is true.

The result of this operation is an array of edit result objects. Each edit result indicates if the edit was successful or not. If successful, the objectId of the result is the ID of the deleted attachment. If not successful, it also includes an error code and an error description.

You can provide arguments to the delete attachments 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
attachmentIds Description: The IDs of the attachments to be deleted.

Syntax: attachmentIds=<attachmentId1>, <attachmentId2>

Example: attachmentIds=58, 4
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: In this sample URL the delete attachments operation is performed on feature id 818654 belonging to layer 0 of the 311Incidents FeatureService

http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0/818654/deleteAttachments

The input parameter to this operation (attachmentIds) is a list of Ids of attachments to be deleted

4,58

JSON Response Syntax

{
 "deleteAttachmentResults": [
  {
   "objectId": <attachmentId1>,
   "globalId": "<globalId1>",
   "success": <true | false>,
   "error" : { //only if success is false
      "code" : <code1>,
      "description" : "<description1>",
    }
  },
  {
   "objectId": <attachmentId2>,
   "globalId": "<globalId2>",
   "success": <true | false>,
   "error" : {
      "code" : <code2>,
      "description" : "<description2>",
    }
  }
 ]
}

JSON Response Example

{
 "deleteAttachmentResults": [
  {
   "objectId": 58,
   "globalId": null,
   "success": true
  },
  {
   "objectId": 4,
   "globalId": null,
   "success": false,
   "error": {
    "code": 50,
    "description": "Attachment not found"
   }
  }
 ]
}