<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How can I query more than 10,000 users at a time from my Portal? in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-can-i-query-more-than-10-000-users-at-a-time/m-p/1114381#M6792</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/180019"&gt;@LongDinh&lt;/a&gt;&amp;nbsp; has the right kind of solution, I think. But to elaborate on the problem, this appears to be a limitation that's baked in, per the &lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/user-search.htm" target="_blank"&gt;REST API docs&lt;/A&gt;:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;... if the total number is greater than this value, 10000 will be returned. The top 10000 query results are available to retrieve via pagination.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description>
    <pubDate>Fri, 05 Nov 2021 01:47:12 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2021-11-05T01:47:12Z</dc:date>
    <item>
      <title>How can I query more than 10,000 users at a time from my Portal?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-can-i-query-more-than-10-000-users-at-a-time/m-p/1114333#M6790</link>
      <description>&lt;P&gt;I need to pull a list of all our Portal users. There are a couple of Python tools we have built that use this full list, and then iterate through each user to check for various characteristics.&lt;/P&gt;&lt;P&gt;However, now that our Portal has over 11k users we have noticed that the previous code (snippet below) is no longer pulling the complete list. It pulls only 10,000 records, even though the &lt;STRONG&gt;max_users&lt;/STRONG&gt; parameter is set to 99,999.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;user_list = gis.users.search(query='!admin', max_users=99999)&lt;/LI-CODE&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.UserManager.search" target="_blank"&gt;https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.UserManager.search&lt;/A&gt;&amp;nbsp;does not mention any sort of &lt;STRONG&gt;start&lt;/STRONG&gt; parameter which I could potentially use to paginate, just the &lt;STRONG&gt;max_users&lt;/STRONG&gt; option. Is there something that I can do which will let me query that full list of more than 10,000 users? I can switch over to using the REST API if I absolutely must, but it's surprising/disappointing to me that I can do almost anything else through the ArcGIS API for Python.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2021 22:16:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-can-i-query-more-than-10-000-users-at-a-time/m-p/1114333#M6790</guid>
      <dc:creator>EricaPfister</dc:creator>
      <dc:date>2021-11-04T22:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: How can I query more than 10,000 users at a time from my Portal?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-can-i-query-more-than-10-000-users-at-a-time/m-p/1114353#M6791</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/66561"&gt;@EricaPfister&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;It seems that arcgis module has not implemented pagination yet. According to the &lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/user-search.htm" target="_self"&gt;User Search API&lt;/A&gt;, you can search from an index using the&amp;nbsp;&lt;EM&gt;start&lt;/EM&gt;&amp;nbsp;parameter which is used to paginate the search result.&lt;/P&gt;&lt;P&gt;The API reference notes are a bit vague, but t&lt;SPAN&gt;o search for 100,000 users or until the max users is reached, it would go something like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import requests

# Get your token
token = getToken() # A function to retrieve an Admin Portal Token to access the API

# Payload init values
query = ""
start = 1
num = 50
sortField = 'username'
returned_total = 1000

total_users_to_return = 100000

user_search_api = "https://.../arcgis/sharing/rest/communitiy/user"

# Search through entire portal for users until the total number returend
next_start = True
user_count = 0

results = []
_next_start = None
while next_start and user_count &amp;lt;=total_users_to_return:
    if _next_start is not None:
        start = _next_start
    payload = {
        'q':query,
        'start':start,
        'sortField': sortField,
        'num':num,
        'f':'json',
        'token':token
    }
    try:
        response = requests.post(
            user_search_api,
            data=payload
        )

        resp_json = response.json()
        # Add the result to the results
        if resp_json.get('results'):
            results += resp_json.get('results')

        # Check while conditions
        user_count += resp_json.get('total')

        if resp_json.get('nextStart'):
            _next_start = resp_json.get('nextStart')
        else:
            # Stop the loop
            next_start = False
        
    except Exception as e:
        print (e)
        print (f"Failed to get start index: {start}")
        continue
 

print (f"Retrieved {len(results)} users.")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2021 01:51:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-can-i-query-more-than-10-000-users-at-a-time/m-p/1114353#M6791</guid>
      <dc:creator>LongDinh</dc:creator>
      <dc:date>2021-11-05T01:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: How can I query more than 10,000 users at a time from my Portal?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-can-i-query-more-than-10-000-users-at-a-time/m-p/1114381#M6792</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/180019"&gt;@LongDinh&lt;/a&gt;&amp;nbsp; has the right kind of solution, I think. But to elaborate on the problem, this appears to be a limitation that's baked in, per the &lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/user-search.htm" target="_blank"&gt;REST API docs&lt;/A&gt;:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;... if the total number is greater than this value, 10000 will be returned. The top 10000 query results are available to retrieve via pagination.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Fri, 05 Nov 2021 01:47:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-can-i-query-more-than-10-000-users-at-a-time/m-p/1114381#M6792</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-11-05T01:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: How can I query more than 10,000 users at a time from my Portal?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-can-i-query-more-than-10-000-users-at-a-time/m-p/1114387#M6793</link>
      <description>&lt;P&gt;Good catch&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;. I misinterpreted that as 10,000 for the num parameter rather than query result.&lt;/P&gt;&lt;P&gt;So perhaps manipulating the query parameter to return &amp;lt;10,000 results would work. For example, you could query a date range (by month) from &lt;EM&gt;DatetimeBefore&amp;nbsp;&lt;/EM&gt;until &lt;EM&gt;DatetimeNow&amp;nbsp;&lt;/EM&gt;which would hopefully return &amp;lt;10,000 at each iteration.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2021 03:34:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-can-i-query-more-than-10-000-users-at-a-time/m-p/1114387#M6793</guid>
      <dc:creator>LongDinh</dc:creator>
      <dc:date>2021-11-05T03:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: How can I query more than 10,000 users at a time from my Portal?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-can-i-query-more-than-10-000-users-at-a-time/m-p/1114400#M6794</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/66561"&gt;@EricaPfister&lt;/a&gt;&amp;nbsp;, this is how you do it in ArcGIS API&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't use the user.search because if there is a corrupt profile the whole query fails.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This script will iterate trough each user and skip broken profiles.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;arcgis&lt;BR /&gt;&lt;BR /&gt;url = &lt;SPAN&gt;"https://url.com/portal"&lt;BR /&gt;&lt;/SPAN&gt;admin_user = &lt;SPAN&gt;'username'&lt;BR /&gt;&lt;/SPAN&gt;password = &lt;SPAN&gt;'password'&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;con = arcgis.gis.GIS(url&lt;SPAN&gt;, &lt;/SPAN&gt;admin_user&lt;SPAN&gt;, &lt;/SPAN&gt;password&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;verify_cert&lt;/SPAN&gt;=&lt;SPAN&gt;True&lt;/SPAN&gt;)&lt;BR /&gt;user_manager = arcgis.gis.UserManager(con)&lt;BR /&gt;&lt;BR /&gt;users_count = user_manager.advanced_search(&lt;SPAN&gt;query&lt;/SPAN&gt;=&lt;SPAN&gt;"0123456789ABCDEF AND !_esri"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;return_count&lt;/SPAN&gt;=&lt;SPAN&gt;True&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;for &lt;/SPAN&gt;user_num &lt;SPAN&gt;in &lt;/SPAN&gt;range(&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;users_count+&lt;SPAN&gt;1&lt;/SPAN&gt;):&lt;BR /&gt;    &lt;SPAN&gt;try&lt;/SPAN&gt;:&lt;BR /&gt;        user = user_manager.advanced_search(&lt;SPAN&gt;query&lt;/SPAN&gt;=&lt;SPAN&gt;"0123456789ABCDEF AND !_esri"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;start&lt;/SPAN&gt;=user_num&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;max_users&lt;/SPAN&gt;=&lt;SPAN&gt;1&lt;/SPAN&gt;)&lt;BR /&gt;        print(user)&lt;BR /&gt;        print(user[&lt;SPAN&gt;'results'&lt;/SPAN&gt;][&lt;SPAN&gt;0&lt;/SPAN&gt;].username)&lt;BR /&gt;    &lt;SPAN&gt;except &lt;/SPAN&gt;Exception &lt;SPAN&gt;as &lt;/SPAN&gt;e:&lt;BR /&gt;        print(&lt;SPAN&gt;f"User &lt;/SPAN&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;user_num&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt; failed"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;Hope it Helps&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Henry&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2021 07:07:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-can-i-query-more-than-10-000-users-at-a-time/m-p/1114400#M6794</guid>
      <dc:creator>HenryLindemann</dc:creator>
      <dc:date>2021-11-05T07:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: How can I query more than 10,000 users at a time from my Portal?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-can-i-query-more-than-10-000-users-at-a-time/m-p/1676504#M11834</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/400739"&gt;@HenryLindemann&lt;/a&gt;&amp;nbsp; is there an enhancement in play that can allow us to query for more than 10000 users at a time.&amp;nbsp; This is problematic if the users could come back in a different order if batching.&amp;nbsp; We are using 64bit software, 10000 seems like a low hard limit.&amp;nbsp; Thinking 100s of thousands should be supportable...&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jan 2026 21:04:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-can-i-query-more-than-10-000-users-at-a-time/m-p/1676504#M11834</guid>
      <dc:creator>JTessier</dc:creator>
      <dc:date>2026-01-07T21:04:40Z</dc:date>
    </item>
  </channel>
</rss>

