Listing Layers on a Server

10-07-2020 07:17 PM
by Anonymous User
Not applicable


I used the script in the link below to export the folders and services from a server to an excel spreadsheet but wanted to find out if there is a way to alter the script to also export the layers in the services and possibly the layer's item ID. Or if anyone has done something similar to this a different way I'm all ears.

Example: Write properties of all services to a CSV file—Documentation (10.3 and 10.3.1) | ArcGIS Ent... 


0 Kudos
2 Replies
MVP Esteemed Contributor

That code you reference is a great example of Esri's right hand not knowing what its left hand is doing.  Esri introduced ArcGIS API for Python | ArcGIS for Developers in December, 2016 (right after ArcGIS Enterprise 10.5 was released) as a definitive Python wrapper for the REST API.  Here we are almost 4 years later, and Esri is just carrying the outdated code samples forward in their documentation with each new release.

My first suggestion, do not try to roll your own Python httplib code for interacting with the REST API with Python.  My second suggestion, check out the ArcGIS API for Python | ArcGIS for Developers API reference, guide, and sample notebooks.

Regarding your question about "the layer's item ID," are you just referring to the layer's ID in the service?

0 Kudos
by Anonymous User
Not applicable

Hello Krista

If you want to get layer ID info, you could try rest point something like 

1. List all services you have by 


2. Then pass the service name to below rest point format and interpret the response


BTW:  you need to add token stuff in the request.



0 Kudos