HI
I am new to python and ArcGIS Notebooks so want to know if the following would be possible.
I am trying to connect the the REST Services directory on our server, and export a list of services to an excel file that would contain initially the service name and all of the pooling information.
I am trying to find an easy way to find which services are dedicated or shared, so thought that filtering an excel sheet would be the simplest way to do this.
If it is possible could you give me some pointers on how to do it please.
Hi @AndyIngall,
You can get in and get a lot of info about the services but I'm not sure you can get information on Dedicated versus Shared. It could perhaps be ascertained from other properties but I have not dug too deep.
Here's how to get to the info...
from arcgis.gis import GIS
## access Portal
portal = GIS("home")
## access the Server (you might want to print out the .list() to see which
## server to access with the index[]
server = portal.admin.servers.list()[0]
## create a ServerManager object
server_manager = server.services
## for each folder in ther server
for folder in server_manager.folders:
## for each service in the folder
for service in [s for s in server_manager.list(folder) if s.type == "MapServer"]:
## here is where you would extract the information from the service
## for now we print the properties for the service
## you might want to limit to just print out for a service or two
## to see what is returned. Maybe a dedicated versus shared.
print(json.dumps(dict(service), indent=4))
Please let us know how you get on and if you find any properties that distinguish between Dedicated and Shared.
All the best,
Glen