AnsweredAssumed Answered

Create View of Hosted Feature Service using Python API

Question asked by mitch.east86_GADNRWRD on Feb 15, 2018
Latest reply on Oct 31, 2018 by glavenuesrifrance-fr-esridist

Has anyone used the Python API to create Views of a hosted feature service on ArcGIS Online?

 

I have a hosted feature service (type = feature layer collection) and want to automate creation of Views. The arcgis.gis module has a method called create_service with an optional parameter to specify if the service is a View. 

 

I've tested this on a dummy feature service. See the python below that results in an error ('Item' object has no attribute 'create_service'). 

 

from arcgis.gis import GIS

from arcgis.gis import ContentManager
mygis = GIS("https://www.arcgis.com", "username", "password")
GMitem = mygis.content.get('itemID')

GMitem.create_service(name = "GM_COPY_Reg1",is_view = TRUE)

Outcomes