I'm writing a script to upload a FGDB to ArcGIS Online, view it in a web map, and edit it. Using the API for Python. I've figured everything out except how to turn on editing (create, update, delete, etc). Anyone have any idea how to do that?
Any help would be appreciated.
Thanks.
To turn on editing, you need to access the published layer as a FeatureLayerColleciton object in Python and perform an `update_definition()` operation as shown below:
from arcgis.features import FeatureLayerCollection
fortune_fl_item = gis.content.search('title:your_feature_layer', item_type = 'Feature Layer')[0]
flc = FeatureLayerCollection(fortune_fl_item.url, gis)
flc.manager.update_definition({'capabilities':'Create,Delete,Query,Update,Editing,Extract'})
We gave a talk at the UC about this, you can find the notebook here: https://github.com/Esri/arcgis-python-api/blob/master/talks/uc2017/ArcGIS%20Python%20API%20-%20Advan... If you scroll down to the part that talks about 'Editing features' you can find the workflow
Thanks. I had just read it here: Updating feature layer properties | ArcGIS for Developers
I appreciate the help.
Hi,
When I run the update_definition on my hosted feature layer published using file geodatabase. I get the following error:
code -
flc.manager.update_definition({'capabilities':'Create,Delete,Query,Update,Editing'})
Any ideas on what could be the issue?
Same error here, using ArcGIS API for Python 2.1.0.2.
If you use the code below in a FeatureClass enabled for editing directly in ArcGIS Online (via the user interface), it responds "capabilities": "Create,Delete,Query,Update,Editing", but if you turn off and try fl.manager.update_definition(, same error of @SarthakTewari24 (in <module> fl.manager.update_definition({'capabilities': 'Create,Delete,Query,Update,Editing'}) Exception: Unable to update feature service definition.
Invalid definition for 'Capabilities'.
Invalid definition for System.String
(Error Code: 400).
props = fl.properties
print(props)