Skip To Content
ArcGIS Developers
Dashboard

Append (Feature Service)

Description

ArcGIS Online and ArcGIS Enterprise hosted feature services support the append operation, a high-performance API capable of handling large volumes of data that has the ability to upsert data.

Upsert

Upsert is a combination of insert and update, driven by the featureId. Upsert is used to add new features and update existing features at the same time. If a feature in the source data matches an existing feature in the destination layer, the existing feature is updated with the values from the source. If there is no match, a new feature is created based on the values from the source.

The append operation currently supports featureId of type ObjectId and GlobalId. The target layer must have a destination field of one of these types.

Unique index on source data featureId

The destination objectId or globalId fields do not need to be mapped to source fields of the same type. The source featureId can come from different field types as long as the values are acceptable destination values for featureId. For example, a destination globalId can be mapped to the GlobalId, Guid, and string field types, and the objectId can be mapped to the short or long field types.

Note:

When appending with upsert set to true, the append operation checks for uniqueness for the source featureId. Currently, it is not acceptable to append two source rows to the same destination row, as the append operation would return an error if more than one source feature share the same featureId.

Enable and disable append capabilities

Feature service Append capabilities must be enabled for the append operation to be used by nonadministrative users. Organization administrators or the service owner can use the append operation without adding the Append capability to the feature service. The Append capability needs to be added to the service capabilities property only if the service owner or organization administrators needs to allow a nonadministrator user to append data to a feature service. Organization administrators or the service owner can enable or disable the Append capability on an existing feature service using the feature service updateDefinition API as shown in the example below. For more information on how to add the Append capabilities to a feature service, see Update Definition (Feature Service).

The Append capability does not require any editing capabilities to be enabled. Features will be inserted or updated when upsert is set as true through the append operation without the administrator adding either the Create or Update capabilities to the feature service.

Supports append

A feature service returns the supportsAppend metadata property. When this property is absent or is returned as false, the Append capability cannot be added to the feature service and the feature service does not support the Append operation, even for the organization administrators or feature service owner.

Supported append formats

A feature service that supports append returns the supportedAppendFormats metadata property. This property lists the supported appendUploadFormat values for this operation.

The append formats are:

  • sqlite: sqlite database
  • gpkg: geopackage
  • shapefile: shapefile
  • filegdb: file geodatabase
  • featureCollection: feature collection
  • geojson: GeoJSON
  • csv: Comma separated values
  • excel: Microsoft Excel format

Sync and Change Tracking

The Append capability is not currently supported if the feature service has sync or changeTracking capabilities enabled. When either sync or changeTracking is enabled on the feature service, Append is blocked for the following reasons:

  • The Esri sync engines might not be able to support syncing the changes from the append operation. The append operation might be using a very low-level database API that might prevent the use of triggers to track the changes from the append operation. ArcGIS Online feature service sync engines rely on triggers to track the edit changes.
  • The volume of changes from append might be quite large for the syncing process and it will be better for the client to re-create the replica after append.

Attempting to set the upsert parameter to true will return an error if sync or change tracking are enabled.

Feature service layer views

The Append capability can be enabled on feature service layer views.

Preserve featureId

The source featureId (ObjectId or GlobalId) are only preserved when upsert is set to true. When upsert is false, all rows created will have new ObjectId or GlobalId values allocated by the system.

Feature service metadata

The feature service metadata is updated after adding or updating data using the append operation. The extent and lastEditDate of the feature service will be updated.

Geocoding

In ArcGIS Online services, the append operation supports geocoding geometry from CSV and Excel data. The cost and billing of geocoding is the same cost and billing of geocoding during publishing data as a feature service.

Editor tracking and ownership-based access control (OBAC)

Editor tracking is currently supported with feature service append API. The CreationDate, EditDate, Editor, and Creator are populated based on the user who is calling append. Editor tracking fields are set when inserting or updating existing features. The creator and the editor fields will be set to the append user. Service owners and administrators will bypass any OBAC set on the feature service. For nonowners, if "allowsUpdateToOthers" is set to false on the feature service, the append user can only update their features or features owned by anonymous users.

Appending multipatch data (ArcGIS Online)

Appending/upserting data to a multipatch feature service is supported. In ArcGIS Online, the client can turn on Append capability on a multipatch feature service using the feature service updateDefinition operation. Similar to a nonmultipatch feature service, ObjectId, GlobalId, or any other fields with unique index can be used to upsert data to a multipatch feature service. The append operation will return an error when a client tries to append nonmultipatch geometry data into a feature service that stores multipatch geometries.

Request parameters

ParameterDetails
layers

The list of layers and table to upload.

Syntax:

layers=[<layer1>, <layer2>, <layer3>]

Example:

layers=0,1,2
layerMappings

This is needed only if the source contains more than one table or if you need to specify field mapping for the destination layer. Used to map source data to a destination layer. The layerMappings parameter contains a fieldMappings object that is optional.

Syntax:

layerMappings=[{"id": <layerID>, "sourceTableName": <"tableName">, "fieldMappings": [{"name" : <"targetName">, "sourceName": <"sourceName">}, ...]

Examples:

layerMappings=[{"id" : 0, "sourceTableName" : "Countries"}]
edits

Only a feature collection is supported. Append supports all formats through the uploadId.

upsert

(Optional)

Used to specify whether the edits need to be applied as updates if the features already exist. The default value is false and ObjectId is used by default.

Values: true | false

appendUploadId

The ID for the uploaded item that contains the source file. Used in conjunction with editUploadFormat.

Example:

appendUploadId=0c6b928f590f49ebac04761bab413e49

The uploadId can be passed to the append operation if analyzing the data is not needed. Any upload items are temporary items and will be cleaned by the system. The uploads operation supports a single-item upload to 10M and multipart uploads for more than 10M size files.

appendItemId

The ID for the geowarehouse item that contains the source file. Used in conjunction with editsUploadFormat.

Example:

appendItemId=894d8c12438v4baaac164b636f7e1e2f

The source file can be added as an item to your portal and the itemId can be passed to the append API. The itemId can be used to analyze the source data file to learn information about a source field's name and provide a UX to map the source fields to the destination layer fields. The item added using the addItem operation is a permeant item and will need to be cleaned up, if necessary, by the caller after the append operation is finished.

appendUploadFormat

The source append data format. The default is the featureCollection format.

Values: sqllite | shapefile | filegdb | featureCollection | geojson | csv | excel

rollbackOnFailure

(Optional)

Used to specify whether the upsert edits need to be rolled back in case of failure. The default value is false.

Value: true | false

f

The response format. The default value is html.

Value: json | html

Example one: append a shapefile

Appending data from a shapefile to a feature service.

https://services.myserver.com/<tenant>/ArcGIS/rest/services/USA/FeatureServer/append?

Parameters:

layers: 0
upsert: false
useGlobalIds: false
appendItemId: 0c6b928f590f49ebac04761bab413e49
rollbackonFailure: true
f: html

JSON Response example

{
  "status": "processing",
  "statusMessage": "Job Status for jobId: b62e9db7-507c-443d-3473-8a1f7a7e9fac",
  "itemId": "cc7ddbc1e33440688d3110c885fa0b30"
}

Example two: checking a job status

https://services.myserver.com/<tenant>/ArcGIS/rest/services/USA/FeatureServer/append/jobs/b62e9db7-507c-443d-3473-8a1f7a7e9fac?

JSON Response example

{
  "layerName": "CITIES",
  "submissionTime": 1520876908117,
  "lastUpdatedTime": 1520876913647,
  "recordCount": 2,
  "status": "Completed"
}

Example three: append a file geodatabase

https://services.myserver.com/<tenant>/ArcGIS/rest/services/USA/FeatureServer/append?

Parameters

layers: 0
layerMappings: [{"id":0,"sourceTableName":"USA"}]
upsert: false
userGlobalIds: false
appendUploadId: 0c6b928f590f49ebac04761bab413e49
appendUploadformat: filegdb
rollbackonFailure: true
f: html

JSON Response example

{
  "status": "processing",
  "statusMessage": "Job Status for jobId: feeahh1e-e32c-45bf-680c-f4ed70569081",
  "itemId": "aa7gdww1e55200527d3110c634fa0b30"
}