Append data to existing feature layer (Python)

4096
3
Jump to solution
01-06-2020 09:50 PM
JackSilburn
New Contributor III

Hello

I'm writing a Python program to publish (append) data to an ArcGIS Online feature layer, every 10 minutes.

I am having issues understanding how to implement the ArcGIS REST API method required to achieve this.

  1. Doing testing with the 'Update Data > Append Data to Layer' button in ArcGIS Online;
  2. I uploaded a test .csv file and inspected the network activity in Chrome developer tools;

3. I was hoping to mimic these requests, but instead of a .csv file, the data comes from a json string in code.

4. Are addItem, analyse and append all required for this operation?

5. My understanding is that addItem requires a 'file' to be uploaded. Can I get around this by sending the data in the append request? Perhaps as a featureCollection?

This all seems quite complicated, as compared to the updateFeatures method which I have used previously.

Side question, I am querying a variety of sensor data. If I append the sensor data to their ArcGIS Online feature counterparts, will I end up with duplicate features, stacked on top of one another? I only need one feature for each sensor location.

Am I better off not using a feature layer for this task?

Regards

0 Kudos
1 Solution

Accepted Solutions
JackSilburn
New Contributor III

I sort of figured this out, using addFeatures from the ArcGIS Online REST API.

See this thread: Add multiple features in addFeatures API request? (posted by me also!)

View solution in original post

3 Replies
JoshuaBixby
MVP Esteemed Contributor

Given that ArcGIS API for Python | ArcGIS for Developers is primarily a Python wrapper for the ArcGIS REST API, I suggest you use the ArcGIS API for Python instead of trying to create your own REST calls via HTTP in Python.

JackSilburn
New Contributor III

I sort of figured this out, using addFeatures from the ArcGIS Online REST API.

See this thread: Add multiple features in addFeatures API request? (posted by me also!)

carlosreyes_dotca
New Contributor II

Would you happen to know how to append attachments to the records?

Thanks!

Carlos 

0 Kudos