Select to view content in your preferred language

Programatically check if Portal items are being used.

821
2
08-12-2020 09:42 AM
JaredCleghorn
Emerging Contributor

I am trying to figure out a way to check if items in the Portal are being used. I want to be able to flag items for removal if they are not being used. There is the usage method in the GIS module that does what I want, however it is for ArcGIS Online only.  "For item owners and administrators, usage provides usage details about an item that help you gauge its popularity. Usage details show how many times the item has been used for the time period you select. " Is there something like this for the Portal? #python #gis() #usage #portal

0 Kudos
2 Replies
JasonBartley1
New Contributor

I don't know how reliable this is, but I have used the numViews property for Portal items to get an idea of usage over time. I ran a script every day to capture daily view count, then use some other functions to see activity over time. Hope this helps!

from arcgis.gis import GIS

gis = GIS(portal_url, username, password)

# find all items
items = gis.content.search(''''max_items=10000)
for item in items:
    print(item.numViews)
JaredCleghorn
Emerging Contributor

Jason, thanks for your response. This is the exact same solution I came up with so far. I was hoping there was a built in method like usage for ArcGIS Online so I would not have to store the number of views over time myself.

0 Kudos