Hi everyone - I have a GeoJSON file that I loaded to ArcGIS Online as a hosted feature layer. The GeoJSON file updates periodically, and I want to automate overwriting the whole AGOL hosted feature layer layer with the latest data. I am using Python to automate this, and I honestly don't care if I use the ArcGIS API for Python or just interact with the REST services directly. I'd like to avoid ArcPy so I can install it on a linux server with no other ArcGIS software.
Manually, it's really easy to do this (see screenshot). I initially loaded a GeoJSON file to AGOL. I find its hosted feature layer, click on "Update Data", select the overwrite option, select the new file, and it's all taken care of. This is the process I'd like to automate.
In the ArcGIS API for Python, I see the FeatureLayer object has an append method, which looks like what I want. That method has an "upload_format" input, and "geojson" is one of the options. But where and how do I pass in the GeoJSON file itself? I couldn't find any code samples of this.
Note1: I suppose I could read the GeoJSON and construct a "regular" feature request, but I'd like to find a way to just upload the whole GeoJSON file, like I can do with the AGOL web GUI.
Note2: I probably need to delete old features before I append, but I know how to do that, if needed.
As I said, I am ok with just interacting with the REST API via Python, if that's any easier. I tried watching Chrome Developer Tools while I did the manual steps above, but I couldn't quite figure out how to replicate that.
thanks!!!