Select to view content in your preferred language

Find out which services are used in a web-map with a script?

12-04-2017 06:10 PM
New Contributor II

Is there a way to find out with a script (in Python or JavaScript) which services a web-map is using and then find out which mxds were used to create these services? Which libraries or modules? I am so lost! I can do it by simply clicking and checking settings and properties, but need to do it for few maps and looking for an automated way. 

Tags (3)
0 Kudos
1 Reply
Esri Notable Contributor

This should be possible using Python.  I'll include endpoints that you can use.

1)  Get a list of each user in the Portal:

2) Loop through each users content:<user>

3) Find each webmap in the content and loop through the services:<itemID>/data

4)  If the host name of the URL matches whatever Server host you're expecting, parse the URL to construct the URL to the admin endpoint of the service:<serviceName>/MapServer -><serviceName>.MapServer

5)  Append iteminfo/manifest/manifest.json to get the information about datasets in the map:<serviceName>.MapServer/iteminfo/manifest/manif... 

6)  Check the onPremisePath property for the original MXD path:


    "databases": [{
        "byReference": false,
        "onServerWorkspaceFactoryProgID": "esriDataSourcesGDB.FileGDBWorkspaceFactory.1",
        "onServerConnectionString": "DATABASE=C:\\arcgisserver\\directories\\arcgissystem\\arcgisinput\\<serviceName>.MapServer\\extracted\\v101\\default.gdb",
        "onPremiseConnectionString": "DATABASE=<path>",
        "onServerName": "default.gdb",
        "onPremisePath": "",
        "datasets": [{
            "onServerName": "<dataSetName>"
    "resources": [{
        "onPremisePath": "<path>",
        "clientName": "<machine>",
        "serverPath": "C:\\arcgisserver\\directories\\arcgissystem\\arcgisinput\\<serviceName>.MapServer\\extracted\\v101\\<serviceName>.msd"
0 Kudos