Is there a limit to API calls?

1774
6
Jump to solution
08-29-2019 05:26 AM
ThomasColson
MVP Frequent Contributor

I'm using https://community.esri.com/thread/239341-find-all-content-for-all-users-in-an-agol-subscription-pars...  to pull some statistics, but I'm finding the output limited to 10000 rows, and I know we have more than 10000 items. 

Tags (1)
1 Solution

Accepted Solutions
JoshuaBixby
MVP Esteemed Contributor

Make sure you are working in milleseconds.  Search reference—ArcGIS REST API: Users, groups, and content | ArcGIS for Developers :

The created field contains the date and time an item is created in UNIX time. UNIX time is defined as the number of seconds that have elapsed since midnight January 1, 1970. The portal stores time in milliseconds, so you need to add three zeros to the end of the UNIX time.

View solution in original post

6 Replies
ThomasColson
MVP Frequent Contributor

Or a better way to ask this: 

Is there a way to specify date ranges  in gis.content.search ?

I see https://community.esri.com/thread/224718-arcgis-api-for-python-find-latest-items there is a way to go back so many days, what I'm after is a way to specify a between range, say, I want every item created from 2014-2016, which would allow me to do multiple queries under the 10000 item limit, then concatenate the results. 

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

The simo xu‌ response to the thread you reference appears to answer your question, albeit using "now" for one of the date ends.  Have you tried that code just with different dates?

0 Kudos
ThomasColson
MVP Frequent Contributor

err....ahhhh....I'm "trying". Not the brightest python bulb in the room here. When you say hard code the now part, would that be 

now = someunixtimestamp
0 Kudos
ThomasColson
MVP Frequent Contributor

So I've tried: 

now = '1567084745'
then = '1546300800'

  • itemsList = gis.content.search('uploaded: [' + then + ' TO ' + now + ']', max_items = 10000000)
  • itemsList = gis.content.search('created: [' + then + ' TO ' + now + ']', max_items = 10000000)

And both return nothing

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Make sure you are working in milleseconds.  Search reference—ArcGIS REST API: Users, groups, and content | ArcGIS for Developers :

The created field contains the date and time an item is created in UNIX time. UNIX time is defined as the number of seconds that have elapsed since midnight January 1, 1970. The portal stores time in milliseconds, so you need to add three zeros to the end of the UNIX time.

ThomasColson
MVP Frequent Contributor

So here's what ended up working:

itemsList = gis.content.search(query = 'created: [1559394001000 TO 1567086853000]', max_items = 10000000)

But now I'm running into another road block: we create a lot of content! I originally went back to Jan of 2019, which still put me against the 10000 item throttle limit. So chunking this up into 6-month calls is a little time consuming, as I need to go back to 2010.