If you're comfortable with a bit of Python, this is pretty doable using the ArcGIS Python API. Items added "from the web" will be stored in the map's JSON, and this is searchable.
Here's a little script we run when we're looking for dependencies. This is written for checking within a single Portal, but could easily adapt for cross-portal checking by entering the URL instead of the itemID.
from arcgis import GIS
from arcgis.mapping import WebMap
import pandas as pd
# connect to portal
gis = GIS('your portal url', 'user', 'pass')
print('Let''s find some dependencies!')
print('Works best w/ ItemID, but you can use a URL, too.')
itemid = input('Enter ItemID (leave empty for URL): ')
item = gis.content.get(itemid)
# check item type. pull url if service
if item.type in ['Feature Service', 'Tile Layer', 'Map Service']:
itemurl = gis.content.get(itemid).url if itemid else input('Service URL: ')
print('Feature service detected. Looking for web maps with this layer.')
webmaps = gis.content.search('', item_type='Web Map', max_items=-1)
map_list = [m for m in webmaps if str(m.get_data()).find(itemurl) > -1]
print(f'{len(map_list)} maps found!')
elif item.type in ['Web Map']:
print('Web map detected. Checking for apps that reference this map.')
map_list = [item]
else:
itemurl = 'no url'
# get apps that reference url or matched maps
apptypes = ['Application', 'Dashboard', 'Story Map', 'Web Experience']
webapps = [item for sublist in [gis.content.search('', item_type=t, max_items=-1) for t in apptypes] for item in sublist]
app_list = []
for w in webapps:
try:
wdata = str(w.get_data())
criteria = [
wdata.find(find_url) > -1,
wdata.find(find_id) > -1,
any([wdata.find(m.id) > -1 for m in map_list])
]
if any(criteria):
app_list.append(w)
# Some apps don't have data, so we'll just skip them if they throw a TypeError
except:
continue
print(f'{len(app_list)} apps found!')
# create dataframe
dependencies = pd.concat(
[
pd.DataFrame([{'title':a.title, 'id':a.id, 'type':a.type, 'url':f'{gis.url}/home/item.html?id={a.id}'} for a in app_list]),
pd.DataFrame([{'title':m.title, 'id':m.id, 'type':m.type, 'url':f'{gis.url}/home/item.html?id={m.id}'} for m in map_list])
]
)
dependencies.to_csv('dependencies.csv')
- Josh Carlson
Kendall County GIS