Skip To Content
ArcGIS Developer
Dashboard

Append Data

Description

Append Data

The AppendData operation appends tabular, point, line, or polygon data to an existing layer. The input layer must be a hosted feature layer. The tool will add the appended data as rows to the input layer. No new output layer is created.

Request parameters

ParameterDetails
inputLayer

(Required)

The table, point, line, or polygon feature layer that will have data appended to it.

Syntax: As described in detail in the Feature input topic, this parameter can be a URL to a feature service layer. Filters are not supported for this parameter.

REST Examples

//REST web example
{"url": "https://myportal.domain.com/server/rest/services/Hosted/hurricaneTrack/FeatureServer/0"}

//REST scripting example
"inputLayer": {"url": "https://myportal.domain.com/server/rest/services/Hosted/hurricaneTrack/FeatureServer/0"}
appendLayer

(Required)

The table, point, line, or polygon features to be appended to inputLayer. To append geometry, appendLayer must have the same geometry type and time type as inputLayer.

Syntax: As described in Feature input, this parameter can be one of the following:

  • A URL to a feature service layer with an optional filter to select specific features
  • A URL to a big data catalog service layer with an optional filter to select specific features
  • A feature collection

REST Examples

//Rest web example
{"url": "https://myportal.domain.com/server/rest/services/Hosted/hurricaneTrack/FeatureServer/0", "filter": "Month = 'September'"}

//REST scripting example
"appendLayer": {"url": "https://myportal.domain.com/server/rest/services/Hosted/hurricaneTrack/FeatureServer/0", "filter": "Month = 'September'"}
fieldMapping

(Required)

Defines how the fields in appendLayer are appended to inputLayer. By default, all appendLayer fields that match inputLayer schemas will be appended; fields that exist in inputLayer but not in appendLayer will be appended with null values; and fields that exist in appendLayer but not in inputLayer will not be appended. Optionally, you can choose how inputLayer fields will be appended through the following operations:

  • AppendField—Matches the inputLayer field with an appendLayer field of a different name. Field types must match.
  • Expression—Calculates values for the resulting field. Values are calculated using Arcade expressions. Use null to assign null values.

This example appends Average_Sales to Mean_Sales, calculates an expression of WeeklyRate multiplied by 1.5 to append the values for Bonus, and sets a value of null for appended features in Errors.

[{
   "inputLayerField": "Mean_Sales",
   "mappingType": "AppendField",
   "mappingValue": "Average_Sales"
},
{
   "inputLayerField": "Bonus",
   "mappingType": "Expression",
   "mappingValue": "$feature['WeeklyRate'] * 1.5"
},
{
   "inputLayerField": "Errors",
   "mappingType": "Expression",
   "mappingValue": "null"
}]

This example appends STARTDATE to DATE, appends myTimeField with TIME and calculates the average of sum_week1 plus sum_week2 for the field avg_value.

"fieldMapping": [{
   "inputLayerField": "DATE",
   "mappingType": "AppendField",
   "mappingValue": "STARTDATE"
},
{
   "inputLayerField": "TIME",
   "mappingType": "AppendField",
   "mappingValue": "STARTDATE"
},
{
   "inputLayerField": "avg_value",
   "mappingType": "Expression",
   "mappingValue": "Average($feature['sum_week1'], $feature['sum_week2'])"
}]
context

(Optional)

The context parameter contains additional settings that affect task execution. For this task, there are two settings:

  • Extent (extent)—A bounding box that defines the analysis area. Only those features that intersect the bounding box will be analyzed.
  • Processing spatial reference (processSR)—The features will be projected into this coordinate system for analysis.

Syntax:
{
"extent" : {extent},
"processSR" : {spatial reference}
}

f

The response format. The default response format is html.

Values: html | json

Example usage

Below is a sample request URL for AppendData:

https://webadaptor.domain.com/server/rest/services/System/GeoAnalyticsTools/GPServer/AppendData/submitJob?inputLayer={"url":"https://webadaptor.domain.com/server/rest/services/Hurricane/hurricaneTrack/0"}&appendLayer={"url":"https://myportal.domain.com/server/rest/services/Earthquakes/earthquakeTracker/FeatureServer/0"}&fieldMapping=[{"inputLayerField":"time_elapsed","mappingType":"AppendField","mappingValue":"minutes_elapsed"}&context={"extent":{"xmin":-122.68,"ymin":45.53,"xmax":-122.45,"ymax":45.6,"spatialReference":{"wkid":4326}}&f=json

Response

When you submit a request, the service assigns a unique job ID for the transaction.

Syntax:
{
"jobId": "<unique job identifier>",
"jobStatus": "<job status>"
}

After the initial request is submitted, you can use jobId to periodically check the status of the job and messages as described in Check job status. Once the job has successfully completed, use jobId to retrieve the results. To track the status, you can make a request of the following form:

https://<analysis url>/AppendData/jobs/<jobId>

Access results

When the status of the job request is esriJobSucceeded, you can access the results of the analysis by making a request of the following form:

https://<analysis-url>/AppendData/jobs/jobId/inputs/inputLayer?token=<your token>&f=json