AnsweredAssumed Answered

API to Get Item Usage

Question asked by hr404 on Nov 5, 2018
Latest reply on Dec 6, 2018 by simo

Good Morning,

I have been pulling some item usage data from AGOL using the Python API item.usage().

Seems to be working fine for a few of the queries, and not for others.

My python:

from arcgis.gis import GIS,Item
gis = GIS("https://<organiztion>.maps.arcgis.com","<username>","<password>")
item = Item(gis,"<itemid>")
chartdata = item.usage("<daterange>",as_df=True)
print(chartdata)

The chart below shows which ones work for me.

errors

If I run the 6M range, it returns: 

Error generating usage report.
None
Error generating usage report

If I run the 1Y range, it returns:

Traceback (most recent call last):
File "<filepath>.py", line 12, in <module>
chartdata = item.usage("1Y",as_df=True)
File "<windowsuserfolder>\AppData\Local\ESRI\conda\envs\new-environment\lib\site-packages\arcgis\gis\__init__.py", line 6371, in usage
raise ValueError("Invalid date range.")
ValueError: Invalid date range.

It doesn't matter whether you return the Pandas DataFrame or the python dictionary for the result, same errors get generated.

Am I missing something somewhere? 

It would be really nice to get the longer date ranges for my automated reporting I'm working on.
Thanks for any help on this!!


Cameron

Outcomes