<?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: Usage Values Not Being Returned in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/usage-values-not-being-returned/m-p/1704160#M11940</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/189832"&gt;@mpboyle&lt;/a&gt;&amp;nbsp;just wondering if you found a resolution to this issue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am experiencing the same issue when trying to get usage statistics for hosted tile layers, using the .usage() method from the arcgis api for python the code works fine for other service types but for hosted tile layers the dataframe is empty and no statistics are retrieved.&lt;/P&gt;</description>
    <pubDate>Mon, 25 May 2026 11:43:33 GMT</pubDate>
    <dc:creator>DeirdreSmyth</dc:creator>
    <dc:date>2026-05-25T11:43:33Z</dc:date>
    <item>
      <title>Usage Values Not Being Returned</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/usage-values-not-being-returned/m-p/1659379#M11743</link>
      <description>&lt;P&gt;I'm wondering why usage values are not returned for certain item types, specifically hosted tile layers, when using the Python API?&amp;nbsp; When viewing the Usage tab for these items, counts appear. However, when using the Python API, either the counts are way off, or not even returned.&lt;/P&gt;&lt;P&gt;Is this a known limitation based on item type?&lt;/P&gt;&lt;P&gt;Below are a few examples:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 1: Hosted Tile Layer&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Item usage via the item page&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mpboyle_0-1761064238832.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/142307i4F5EC1A1F5CE8428/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mpboyle_0-1761064238832.png" alt="mpboyle_0-1761064238832.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Item usage via the Python API. The usage values ("num") are not close.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mpboyle_2-1761064545278.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/142309i31755D641B705675/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mpboyle_2-1761064545278.png" alt="mpboyle_2-1761064545278.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 2: Hosted Vector Tile Layer&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Item usage via the item page&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mpboyle_3-1761064605438.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/142310iBAC87637D90C5DF5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mpboyle_3-1761064605438.png" alt="mpboyle_3-1761064605438.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Item usage via the Python API. The data key is an empty list.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mpboyle_4-1761064756133.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/142315i501B342BC2292D5E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mpboyle_4-1761064756133.png" alt="mpboyle_4-1761064756133.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example 3: Hosted Feature Layer&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Item usage via the item page&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mpboyle_5-1761064966523.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/142318iA5526A6DC61216DE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mpboyle_5-1761064966523.png" alt="mpboyle_5-1761064966523.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Item usage via the Python API --- matches the item page&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mpboyle_6-1761065053271.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/142319iA50DA91F6D95C3E3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mpboyle_6-1761065053271.png" alt="mpboyle_6-1761065053271.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2025 16:46:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/usage-values-not-being-returned/m-p/1659379#M11743</guid>
      <dc:creator>mpboyle</dc:creator>
      <dc:date>2025-10-21T16:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: Usage Values Not Being Returned</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/usage-values-not-being-returned/m-p/1704160#M11940</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/189832"&gt;@mpboyle&lt;/a&gt;&amp;nbsp;just wondering if you found a resolution to this issue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am experiencing the same issue when trying to get usage statistics for hosted tile layers, using the .usage() method from the arcgis api for python the code works fine for other service types but for hosted tile layers the dataframe is empty and no statistics are retrieved.&lt;/P&gt;</description>
      <pubDate>Mon, 25 May 2026 11:43:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/usage-values-not-being-returned/m-p/1704160#M11940</guid>
      <dc:creator>DeirdreSmyth</dc:creator>
      <dc:date>2026-05-25T11:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Usage Values Not Being Returned</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/usage-values-not-being-returned/m-p/1704320#M11941</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/686002"&gt;@DeirdreSmyth&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Nope, it's super frustrating.&amp;nbsp; We have multiple hosted tile layers containing imagery projects that we'd like to be able to easily track usage on, but these item types (Map Service) don't return any usage data even though the Usage tab on the item page does.&lt;/P&gt;&lt;P&gt;Hosted vector tile layers are another item type that doesn't return any usage data through the Python API.&amp;nbsp; Again, super frustrating as we use hosted vector tiles for our organizational base maps and we'd like to be able to track usage on those items too.&lt;/P&gt;&lt;P&gt;Below are some examples. We're a County government, our items are open to the public. Item identifiers provided for testing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hosted Tile Layer example&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mpboyle_4-1779802967821.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/153022i13F1318439454B2B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mpboyle_4-1779802967821.png" alt="mpboyle_4-1779802967821.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hosted Vector Tile Layer example&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mpboyle_5-1779803002310.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/153023iB0EA6830DBB197BE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mpboyle_5-1779803002310.png" alt="mpboyle_5-1779803002310.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps someone associated with Esri can provide some insight why these particular item types don't return any data through the Python API...?&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/746669"&gt;@ShareUser&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1021"&gt;@KellyGerrow&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/10527"&gt;@JakeSkinner&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2026 13:44:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/usage-values-not-being-returned/m-p/1704320#M11941</guid>
      <dc:creator>mpboyle</dc:creator>
      <dc:date>2026-05-26T13:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: Usage Values Not Being Returned</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/usage-values-not-being-returned/m-p/1704848#M11944</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/189832"&gt;@mpboyle&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I have not been able to get the .usage method to work but I did find some information on using the usage REST endpoint -&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-online-questions/how-to-get-credit-usage-by-an-application-using/td-p/1105211" target="_blank"&gt;https://community.esri.com/t5/arcgis-online-questions/how-to-get-credit-usage-by-an-application-using/td-p/1105211&lt;/A&gt;&amp;nbsp; this call is about credits but you can do the same for usage.&lt;/P&gt;&lt;P&gt;Essentially it uses the same usage url that the Usage page of an service.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DeirdreSmyth_0-1779960632608.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/153144i008814C7579563C1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DeirdreSmyth_0-1779960632608.png" alt="DeirdreSmyth_0-1779960632608.png" /&gt;&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;url = "&lt;A href="https://your_portal/sharing/rest/portals/" target="_blank"&gt;https://your_portal/sharing/rest/portals/&lt;/A&gt;&amp;lt;portalid&amp;gt;/usage?"&lt;/P&gt;&lt;P&gt;The you append parameters for the start and end date etc., you can do it with setting parameters and using the urllib&lt;/P&gt;&lt;P&gt;#set parameters of request&lt;/P&gt;&lt;P&gt;params = {&lt;BR /&gt;'f': 'json',&lt;BR /&gt;'startTime': int(start.timestamp() * 1000), # Adjust start time as needed (e.g., in epoch milliseconds)&lt;BR /&gt;'endTime': int(end.timestamp() * 1000),&lt;BR /&gt;'period':'1d',&lt;BR /&gt;'vars':'num', #gets the usage statistics, can be num, credits or bandwidth(bw)&lt;BR /&gt;'groupby': 'name',&lt;BR /&gt;'etype':'svcusg',&lt;BR /&gt;'name':item.name,&lt;BR /&gt;'stype':'tiles',&lt;BR /&gt;'token': gis._con.token&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;# 3. Make the API request&lt;BR /&gt;encoded_params = urllib.parse.urlencode(params).encode('utf-8')&lt;BR /&gt;req = urllib.request.Request(url, data=encoded_params)&lt;BR /&gt;&lt;BR /&gt;response = urllib.request.urlopen(req)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or in the call above he's constructed the url from variables:&lt;/P&gt;&lt;P&gt;&amp;nbsp;reportURL = f'https://[your-org].maps.arcgis.com/sharing/rest/portals/[portalID]/usage?startTime={round(enddate.timestamp()*1000)}&amp;amp;endTime={round(enddate.timestamp()*1000)}&amp;amp;period=1h&amp;amp;appId={app_id}&amp;amp;vars=credits,num,bw&amp;amp;groupBy=etype,stype&amp;amp;f=json&amp;amp;token={the_token}'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2026 09:38:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/usage-values-not-being-returned/m-p/1704848#M11944</guid>
      <dc:creator>DeirdreSmyth</dc:creator>
      <dc:date>2026-05-28T09:38:19Z</dc:date>
    </item>
  </channel>
</rss>

