Programmatically update hosted feature layer in AGOL

10-10-2019 09:48 AM
New Contributor II

I am wondering what are the options for updating a hosted feature layer in AGOL. For context, I will be hosting point layer with about 500 features that will be updated nightly from a scheduled task. The initial publishing of the layer does not need to be programmatic, but the nightly update does.

I have been looking into using the REST API update/delete/create endpoints for doing these nightly updates.

My question is, are there any other options for performing these updates outside the REST API? I see there is also a Python API and Native SDKs. Are those libraries using the REST API under the hood?


Tags (1)
3 Replies
by Anonymous User
Not applicable

Hi Joe Saltenberger

The ArcGIS API for Python does use the REST API under the hood. This blog goes into that in a little more depth: ArcGIS API for Python Core Concepts Part 1: Python, APIs, and REST 

There are some good resources on using the Python API to accomplish the workflow here: 

Updating features in a feature layer | ArcGIS for Developers 

Hope this helps,


0 Kudos
MVP Regular Contributor

The following code works for me in order to update hosted feature layer (i.e., overwrite the data):

from arcgis.gis import GIS
source = GIS("", "username", "password", verify_cert=False)
csv = source.content.get('a4e4587122354eb2847d461263e3ccb7')
csv.update({}, r'C:\TEMP\data.csv')
0 Kudos
New Contributor

Hi william, 

I am trying to use your code to update a hosted line feature layer but I keep getting some error. I have used the same code mentioned above changing the URL, username, password, item ID, and csv file reference path.  I have added a screenshot of the error message. Could you please help me to find my mistake? I want to update a hosted feature layer with a csv file. 



0 Kudos