Hi all, would anyone know of a way to query the usage statistics in hosted feature services through any of the APIs to find items that haven't been used in 30, 90 days, etc?
To my knowledge there isn't an easy way to do this. You can create usage reports on how much content is being created but usage on individual services is not straightforward, though Portal or ArcGIS Online. There is an Esri idea where people are asking for something similar:
If this is for an ArcGIS Enteprise deployment, rather than AGOL then you can get access to ArcGIS Server statistics in Server Manager. There you can view the number of requests for given services. It's not exactly what you are after but it allows you to see which services are getting requests and which are not.
Thanks for sharing that, Mark Donnelly! It would be SO helpful for organization administrators to be able to generate reports like that!
I did notice in the comments of that Idea that item.usage() from the Python API will produce similar results....maybe something that would be worth it to look into in the meantime. However, making this functionality available for all org admins, even those without programming experience, is essential!
Good link, Mark. I'm definitely upvoting that. I'm playing around with the .usage() function that Katherine mentioned, looks like it could be promising. I'm definitely not familiar with the API so there's probably better ways to do this but plugging into a Notebook is giving good results so far.
from arcgis.gis import GIS
from IPython.display import display
gis = GIS("home")
items = gis.content.search(query="type:Feature Service")
for item in items:
itemHistory = item.usage(date_range='1Y', as_df=True) # <--- Looking in the past 12 months
total = itemHistory['Usage'].sum()
if total <20: # <--- Less than 20 total views