We're trying to better manage the webmaps that are shared with the organisation in our portal setup. We have had a couple of situations where we've been needing to replace or update a layer with a different version. Associated with the change has been the need to update the webmaps where the replaced layers have been used and have found that it isn't always that easy to identify all of the affected webmaps to make the changes (especially if its a commonly used layer).
I'm looking for a way to identify all of the webmaps in a portal that contain a specific layer. I was hoping that in AGOL Assistant i might be able to search by the layer's itemid, but that only returns the item itself, so its obviously not searching the webmap contents. Its not clear in the ArcGIS Rest API documentation if its even possible to search the webmap contents. At this stage our alternative is that we'll start listing the layers in the item descriptions so at least we can do a description search, but that is a little more overhead we're hoping to avoid.
Is there a way to search for webmaps based on their something in their contents?
Unfortunately, that dependency structure isn't stored within Portal anywhere. You could write a script to loop through all users, and then the content for each user and find all webmaps, then examine the operational or basemap layers for the service in question. Once you find it, replace it and update the webmap.