Is there any way to enable attachments on an existing hosted feature service with the API?
Solved! Go to Solution.
Hi Patrick,
Using the code below I was able to turn on and off attachments to the featurelayer.
The code is straightforward, it searches for and finds the layer you want to change.
featLyr = featCollection.layers[0]
Code:
from arcgis.gis import GIS gis = GIS("https://www.arcgis.com", "<USERNAME>", "<PASSWORD") srcResults = gis.content.search("title:ServiceAreas",item_type = "Feature Layer") featCollection = srcResults[0] featLyr = featCollection.layers[0] #Get the manager associated with the featurelayer to update mgr = featLyr.manager #Update the featurelayer definition to allow attachments mgr.update_definition({"hasAttachments": False})
Let me know if you have any questions.
Thanks,
Jeff
Hi Patrick,
Using the code below I was able to turn on and off attachments to the featurelayer.
The code is straightforward, it searches for and finds the layer you want to change.
featLyr = featCollection.layers[0]
Code:
from arcgis.gis import GIS gis = GIS("https://www.arcgis.com", "<USERNAME>", "<PASSWORD") srcResults = gis.content.search("title:ServiceAreas",item_type = "Feature Layer") featCollection = srcResults[0] featLyr = featCollection.layers[0] #Get the manager associated with the featurelayer to update mgr = featLyr.manager #Update the featurelayer definition to allow attachments mgr.update_definition({"hasAttachments": False})
Let me know if you have any questions.
Thanks,
Jeff
Thanks Jeff. This works.