Select to view content in your preferred language

AGO Credit Usage Download

72
1
Wednesday
AJohnson_HFHI
Emerging Contributor

Hi - I'm looking to utilize the Python-API for downloading a per-user daily credit usage report from ArcGIS Online. 

I'm on the latest version of the python-api. I've tried to utilize the AGOLUsageReports module but it appears it gives a high level snapshot, not per user usage metrics.

I'm trying to replicate the same type of report that ArcGIS Online can generate but more granular per user, and then automatically add the data to local databases for analysis. I've also tried to run similar tools that were shown here: Dev Summit 2024: Manage your organization using ArcGIS API for Python but it doesn't look like gis.users.me.report(...) exists in the current release.

Any help would be appreciated!

0 Kudos
1 Reply
Clubdebambos
MVP Regular Contributor

Hi @AJohnson_HFHI,

It is here.

Dates are returned as epochs so you will need to convert to a date string. You can access each dictionary per username and get the credit consumption for each day.

from arcgis.gis import GIS
import json

agol = GIS("home")

report = agol.admin.usage_reports.users(time_frame="7days")

print(json.dumps(report, indent= 4))

 

Please let us know if this is what you were looking for.

All the best,

Glen

 

~ learn.finaldraftmapping.com
0 Kudos