Query map services by authoring client

367
1
Jump to solution
05-18-2021 05:07 PM
Raj-Chavada
New Contributor III

Hello,

Is there a quick way to gather a list all map services in CSV file using ArcGIS pro client GP tools or programmatically  arcpy module or ArcGIS REST API by authoring client - Arcmap vs Arcgis pro? The main objective is to identify services that are published using ArcMap client ONLY. 

We have ArcGIS Enterprise 10.8.1 with ArcGIS Pro 2.7.

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Notable Contributor

In the ArcGIS Python API, there is the gis.server submodule that you can use for this. Just call "gis.admin.servers" to access it.

From there, you can iterate through your services on a given server and look at the provider property.

gis = GIS('your-portal-url', 'admin-username', 'admin-password')

server = gis.admin.servers.get('HOSTING_SERVER')[0]

for f in server.services.folders:
    for svc in server.services.list(folder=f):
        if svc.properties['provider'] == 'ArcObjects':
            print(f'{svc.properties['serviceName']} is published using ArcMap!')

 

Anything that comes back with a provider value of ArcObjects was published using ArcMap. Instead of printing that string at the end, you could have the script write the service name to a CSV, or populate a list object for further use.

- Josh Carlson
Kendall County GIS

View solution in original post

1 Reply
jcarlson
MVP Notable Contributor

In the ArcGIS Python API, there is the gis.server submodule that you can use for this. Just call "gis.admin.servers" to access it.

From there, you can iterate through your services on a given server and look at the provider property.

gis = GIS('your-portal-url', 'admin-username', 'admin-password')

server = gis.admin.servers.get('HOSTING_SERVER')[0]

for f in server.services.folders:
    for svc in server.services.list(folder=f):
        if svc.properties['provider'] == 'ArcObjects':
            print(f'{svc.properties['serviceName']} is published using ArcMap!')

 

Anything that comes back with a provider value of ArcObjects was published using ArcMap. Instead of printing that string at the end, you could have the script write the service name to a CSV, or populate a list object for further use.

- Josh Carlson
Kendall County GIS