I am writing a script to identify if publicly-shared services have editing enabled. I would like this to correspond to the "Update" option listed under "What kind of editing is allowed" on an item's page in ArcGIS Online/Portal.
According to the REST API, I thought that checking for "Editing" or "Update" in the layer or tables "properties.capabilities" would return this information.
However, after testing my script, I learned that these do not match up. Is there a way to use the Python API to get a listing of what is enabled for editing that matches what is listed on the item's page?
Solved! Go to Solution.
Is the below what you are looking for?
from arcgis.gis import GIS
from arcgis.features import FeatureLayerCollection
## access ArcGIS Online
agol = GIS("home")
## get the Feature Service as an Item object
item = agol.content.get("ITEM_ID")
## FLC represents a Feature Service
flc = FeatureLayerCollection.fromitem(item)
print(flc.properties)
From these you can get the information from the settings page that acts as a master control for all layers and tables in the Feature Service. You can also use the API and the FeatureLayer object to update some capabilities for individual layers and tables.
## Create - Create a feature (editing)
## Query - Query attributes of a feature
## Update - Update feature attributes and geometry (editing)
## Editing - All editing capabilities (Create,Update,Delete)
## Extract - Extract data in various formats
## Sync - Used for offline data use and collaborations
## Delete - Delete a feature (editing)
## ChangeTracking - keep track of editing changes
"capabilities": "Create,Delete,Query,Update,Editing,Sync,ChangeTracking"
"allowGeometryUpdates": true
"allowTrueCurvesUpdates": true
"onlyAllowTrueCurveUpdatesByTrueCurveClients": false
## only availabkle if Editor Tracking has been enabled
"editorTrackingInfo": {
"enableEditorTracking": true,
"enableOwnershipAccessControl": false,
"allowOthersToQuery": true,
"allowOthersToUpdate": true,
"allowOthersToDelete": true,
"allowAnonymousToQuery": true,
"allowAnonymousToUpdate": true,
"allowAnonymousToDelete": true
}
## only available of Change Tracking is enabled
"extractChangesCapabilities": {
"supportsReturnIdsOnly": true,
"supportsReturnExtentOnly": true,
"supportsReturnAttachments": true,
"supportsLayerQueries": true,
"supportsGeometry": true,
"supportsFeatureReturn": true,
"supportsReturnHasGeometryUpdates": false,
"supportsReturnDeletedFeatures": true,
"supportsServerGens": true,
"supportsFieldsToCompare": true
}
I would recommend turning on and off different settings and printing the properties and looking for changes/additions to the output JSON to see what is affected.
All the best,
Glen
Is the below what you are looking for?
from arcgis.gis import GIS
from arcgis.features import FeatureLayerCollection
## access ArcGIS Online
agol = GIS("home")
## get the Feature Service as an Item object
item = agol.content.get("ITEM_ID")
## FLC represents a Feature Service
flc = FeatureLayerCollection.fromitem(item)
print(flc.properties)
From these you can get the information from the settings page that acts as a master control for all layers and tables in the Feature Service. You can also use the API and the FeatureLayer object to update some capabilities for individual layers and tables.
## Create - Create a feature (editing)
## Query - Query attributes of a feature
## Update - Update feature attributes and geometry (editing)
## Editing - All editing capabilities (Create,Update,Delete)
## Extract - Extract data in various formats
## Sync - Used for offline data use and collaborations
## Delete - Delete a feature (editing)
## ChangeTracking - keep track of editing changes
"capabilities": "Create,Delete,Query,Update,Editing,Sync,ChangeTracking"
"allowGeometryUpdates": true
"allowTrueCurvesUpdates": true
"onlyAllowTrueCurveUpdatesByTrueCurveClients": false
## only availabkle if Editor Tracking has been enabled
"editorTrackingInfo": {
"enableEditorTracking": true,
"enableOwnershipAccessControl": false,
"allowOthersToQuery": true,
"allowOthersToUpdate": true,
"allowOthersToDelete": true,
"allowAnonymousToQuery": true,
"allowAnonymousToUpdate": true,
"allowAnonymousToDelete": true
}
## only available of Change Tracking is enabled
"extractChangesCapabilities": {
"supportsReturnIdsOnly": true,
"supportsReturnExtentOnly": true,
"supportsReturnAttachments": true,
"supportsLayerQueries": true,
"supportsGeometry": true,
"supportsFeatureReturn": true,
"supportsReturnHasGeometryUpdates": false,
"supportsReturnDeletedFeatures": true,
"supportsServerGens": true,
"supportsFieldsToCompare": true
}
I would recommend turning on and off different settings and printing the properties and looking for changes/additions to the output JSON to see what is affected.
All the best,
Glen
The issue is that the "capabilities" property does not match the "Add/Delete/Update" checkboxes on the item's page.
I was expecting if "Add" shows up on the item page, it would also show up in "capabilites." But things did not match up this way.
Ahh, right. I haven't seen that behaviour before.
The issue was on my mis-understanding of capabilities. I was originally checking for either "Editing" or "Update."
After re-reading @Clubdebambos comments, I realized I should only have been checking for "Update" capability.