Hello, I am a GIS Tech in over my head attempting to parse some data with a colleague. We have a list of service directories via RESTful service - what is the best way to list the directory and determine the feature classpath in the layers for each service?
We are in over our pay grade here but found this article to use as a jumping-off point although we are still stuck trying to comb through our massive list of data layers..... Help Please
https://gis.stackexchange.com/questions/101816/which-feature-classes-is-are-used-by-service
Solved! Go to Solution.
@JoshuaBixby made a great script which I've been playing about with Solved: Re: Get MXD path property for a service published ... - Esri Community
This is just me playing about with it, if they're in FGDBs the paths should look ok, otherwise if SDE FCs I'd need to play about with the code to get the SDE path, or just remove the .split() method and print the entire connection string.
from arcgis.gis.server import Server
import os
import json
url = 'your server admin address eg. - https://domain:6443/arcgis/admin'
username = '’
password = ‘’
server = Server(url=url, username=username, password=password, verify_cert=False)
sm = server.services
svcs = (
svc
for fld in sm.folders
for svc in sm.list(fld)
if fld not in ['System', 'Utilities']
)
for svc in svcs:
name = svc.serviceName
manifest = json.loads(svc._service_manifest())
if manifest.get("code", 200) == 200:
print("___________ SERVICE: " + name + "___________")
for database in (manifest["databases"]):
#print(database['onServerConnectionString'])
temp_list = []
for dataset in (database["datasets"]):
temp_list.append(dataset)
for x in temp_list:
fc = (x['onServerName'])
print(os.path.join(database['onServerConnectionString'].split('=')[1],fc))
print('\n')
@JoshuaBixby made a great script which I've been playing about with Solved: Re: Get MXD path property for a service published ... - Esri Community
This is just me playing about with it, if they're in FGDBs the paths should look ok, otherwise if SDE FCs I'd need to play about with the code to get the SDE path, or just remove the .split() method and print the entire connection string.
from arcgis.gis.server import Server
import os
import json
url = 'your server admin address eg. - https://domain:6443/arcgis/admin'
username = '’
password = ‘’
server = Server(url=url, username=username, password=password, verify_cert=False)
sm = server.services
svcs = (
svc
for fld in sm.folders
for svc in sm.list(fld)
if fld not in ['System', 'Utilities']
)
for svc in svcs:
name = svc.serviceName
manifest = json.loads(svc._service_manifest())
if manifest.get("code", 200) == 200:
print("___________ SERVICE: " + name + "___________")
for database in (manifest["databases"]):
#print(database['onServerConnectionString'])
temp_list = []
for dataset in (database["datasets"]):
temp_list.append(dataset)
for x in temp_list:
fc = (x['onServerName'])
print(os.path.join(database['onServerConnectionString'].split('=')[1],fc))
print('\n')
WOW! Thank you DavidPike! They are in SDE so I will try to follow your train of thought and between the two of us, I think we will certainly be in a better place for your tips! Thank you!