Is it possible using the ArcGIS API for python to determine the Enable sync status of a hosted feature layer on ArcGIS online?
i.e. this setting:
I don't need to change it at this stage, just determine if it is checked or not.
In context, I intend to loop though all the layers of a web map looking for any layer that does not have sync enabled, using something like this:
from arcgis.gis import GIS from arcgis.mapping import WebMap gis = GIS(url, username, password) map_id = # the_unique_item_identifier would be here # search_result=gis.content.search(map_id,max_items=1000) item = search_result print("map title = ", item.title) theWebMap = WebMap(webmapitem=item) layerCount = len(theWebMap.layers) print("layer count = " + str(layerCount)) for layer in theWebMap.layers: print("type = ", layer.layerType) print("title = ", layer.title) print("id = ", layer.id) # mystery bit - property? custom function? print("syncStatus = ", layer.?????)
You should be able to access the "capabilities" property of the layer (which has sync, editing, create....) by doing the following. The capabilities property is a comma separated string of values.
You can update the layer properties by doing:
"capabilities": "Editing, Sync, Update, Create, Delete" // Whatever other properties you need or that were previously there
Thanks for the suggestion Aaron. I followed up by reading Service definitions | ArcGIS for Developers which has a worked example of displaying and enabling sync for a Feature Layer Collection. However, I'm working with a Feature Layer (Hosted).
Following the example in the docs I can't get it to work for a Feature Layer (hosted).
Do you know if this definitely works with ArcGIS Online, or is it just Portal?
I recently found out that tracing item dependencies using the functions item.dependent_upon() and item.dependent_to() only work for Portal, and not GIS Online - and there is nothing in the documentation about that - so I'm not sure if its my bad programming, or its just not possible with Online?
If properties.capabilities should work for a hosted Feature Layer, can you point me to a worked example?