List GIS Servers by URL instead of Name

1110
3
Jump to solution
11-11-2021 06:15 PM
tigerwoulds
Occasional Contributor III

Following this doc here: Managing your GIS servers | ArcGIS Developer

I am trying to build a list of all GIS Servers federated to my Portal. Running Enterprise 1081. 

 

 

from arcgis.gis import GIS
gis = GIS("http://siteurl.mysite.com/portal", "username")
gis_servers = gis.admin.servers.list()
gis_servers

 

 

 Gives me this:

[<Server at https://pythonapi.playground.esri.com/server/admin>,
<Server at https://python-ga.playground.esri.com/server/admin>,
<Server at https://python-ra.playground.esri.com/arcgis/admin>]

What I need is the URL for the Server, not the admin endpoint. Looks like the list() method does not provide this. Looking in https://portal.domain.com/arcgis/portaladmin/federation/servers/servername I can see the URL attribute. 

TigerWoulds_0-1636683218576.png

Can I get the server URLs using the arcgis python api?

0 Kudos
1 Solution

Accepted Solutions
MehdiPira1
Esri Contributor

Hi @tigerwoulds ,

Try the script below which gives you both urls:

 

gis_servers_properties = gis.admin.servers.properties
for server in gis_servers_properties.servers:
    print(f"Server URL: {server.url}, Server Admin URL: {server.adminurl}")

 

View solution in original post

3 Replies
MehdiPira1
Esri Contributor

Hi @tigerwoulds ,

Try the script below which gives you both urls:

 

gis_servers_properties = gis.admin.servers.properties
for server in gis_servers_properties.servers:
    print(f"Server URL: {server.url}, Server Admin URL: {server.adminurl}")

 

tigerwoulds
Occasional Contributor III

Thank you much! Worked like a charm. 

0 Kudos
MehdiPira1
Esri Contributor

Not a problem, @tigerwoulds.

0 Kudos