AnsweredAssumed Answered

Using the ArcGIS API for Python with a REST service

Question asked by jbridwell_Dewberry on Aug 15, 2018
Latest reply on Aug 15, 2018 by jbridwell_Dewberry

Hey All- I have a public REST service that has several layers and feature classes that I want to access. According to the documentation. Once I have the 'arcgis' package imported, I can inject my outside REST service as such:

 *Note: I am using the Jupyter Notebook to test this code. 

from arcgis.gis import GIS
gis = GIS("https://hazards.fema.gov/gis/nfhl/rest/services/CSLF/Prelim_CSLF/MapServer")

Since this is a public service, I didn't have to include any username or password parameters. The service has several layers (item_type="Feature Layer) that I want to access; namely Special Flood Hazard Area Change layer, but perhaps others:

 

Using the example from the API docs, I tried to do a search in the service just to see all the layers and any info I might need in future calls. I am using the '.search' method from the content manager.

# search and list all feature layers in my contents
search_result = gis.content.search(query="", item_type="Feature Layer")
search_result

Every time I try this, I get an either a KeyError='num' or a TypeError: must be str, not int (if I try to add a query). What am I doing wrong here and what is the proper way to search within this REST service?

 

Outcomes