Hi all, I'm trying to use ArcGIS Notebooks to view dependencies between items for some cleaning up in ArcGIS Online (not Enterprise).
I found the to_dependencies property in the API reference: https://developers.arcgis.com/python/latest/api-reference/arcgis.gis.toc.html#arcgis.gis.ItemDepende..., but it doesn't seem to return anything.
from arcgis.gis import GIS
import pandas as pd
gis = GIS("home")
item = gis.content.get('<itemid goes in here>')
# Get dependencies
dependencies = item.dependencies
print(dependencies)
print(dependencies.properties)
print(dependencies.to_dependencies)
However, passing in the ID of a hosted feature layer that I know is used in multiple web maps and apps returns nothing:
<Dependencies for <item id is displayed here>>
{
"items": []
}
[]If I pass in the ID of a Web Map that has multiple layers within it, I also get no dependencies:
<Dependencies for <item id is displayed here>>
{
"items": []
}
[]I've seen in the documentation that the dependent_upon and dependent_to methods only work in ArcGIS Enterprise, but there is nothing in the documentation that says that the to_dependencies doesn't work in ArcGIS Online.
What am I missing here? Is to_dependencies deprecated?
Hi @MappyIan, you can use the below tool to report an item's dependencies:
Thanks @JakeSkinner, that's really helpful. There are quite a few variants of this tool kicking around (e.g. here) but I hadn't found your tool.
I got the tool to work, which is great, but I have high hopes that this functionality will be added to ArcGIS Online in the next release (February 2025) as suggested in the replies to this particular idea (see page 2). This idea was logged back in 2023, which suggests that has long been a need for this sort of functionality in the core product.
Came here looking for the reason I'm getting exactly the same output from the item.dependencies property as @MappyIan: just a bunch of empty lists for everything in my portal (where I know there are plenty of dependencies).
Looking through the toolbox now and it doesn't use the item dependencies property / ItemDependency object either, assuming because this simply doesn't work at the moment? (One wonders why the entries are still in the API reference, then?) Am I being too optimistic hoping that the reason it's not fixed is that this that dependency reporting is close to being implemented in a GUI in AGOL? 🤣
In any case I'll probably implement the approach being taken in the toolbox; looks straightforward. Thanks for the solution @JakeSkinner
Edit: Poking around in the API Reference later in the day and I found the method .get_dependencies() (vs .dependencies property), and it IS returning stuff (where I expect it to return stuff). Still haven't done much with it but will report back later today or tomorrow if it works for what I (and OP) were trying to do.
Hello,
Did you ever manage to find further solution with the .get_dependencies()? Would be interested in seeing some examples.
Hey @SuzyFer, I never got any further with this due to other priorities. I was intending to revisit it at some point so if you have any examples @AlderMaps I'd be interested to see them too.
After asking this question on here a colleague came across this Dashboard, which is explained in this LinkedIn post, and documented here. I note in the documentation the author of this Dashboard states the following about the get_dependencies method which is interesting:
This script also does not use the get_dependencies method, also in the API reference. This method at least returns something, but it only returns items found within that items own JSON, or downstream items. I.e., it will return all the feature layers found in a given map, but not which apps are consuming that map, and not which maps are consuming a given feature service, etc. (the latter, I would argue, is the whole point of a dependencies tool).
At some point I'm planning to implement the Dashboard linked above across our AGOL instances, at which point I'll have a look at the code and see how it's configured but there might be some useful stuff in there you can use.
Hope this helps.