FRAMES | NO FRAMES | Description | Parameters | Examples | Response |
URL | http://<featureservicefeature-url>/addAttachment (POST only) |
Parent Resource | Feature |
---|---|
Required Capability | Create or Update |
This operation adds an attachment to the associated feature (POST only). The add attachment operation is performed on a feature service feature resource.
Since this request uploads a file, it must be a multi-part request as per IETF RFC1867.
This operation is available only if the layer has advertised that it has attachments.
A layer has attachments if its hasAttachments
property is true
.
See section limiting Upload file size and file types to learn more about default file size and file type limitations imposed for Attachments.
objectId
of the result is the ID of the new attachment.
You can provide arguments to the add attachment 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 |
attachment |
Description:
The file to be uploaded as a new feature attachment.
The content type, size and name of the attachment will be derived from the uploaded file. |
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 |
Example 1: Add an attachment using the add attachment operation on a feature service feature resource. In this sample URL the add attachment 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/addAttachment
The input parameter attachment to this operation is a file.
{
"addAttachmentResult": {
"objectId" : <attachmentId>,
"globalId" : <globalId>,
"success" : <true | false>,
"error" : { //only if success is false
"code" : <code1>,
"description" : "<description>",
}
}
}
{ "addAttachmentResult": { "objectId" : 58, "globalId" : null, "success" : true } }