<?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 to access the application usage using appId and secret (programmatically)? in ArcGIS Enterprise Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-access-the-application-usage-using-appid/m-p/1108818#M31334</link>
    <description>&lt;P&gt;What is your role in your org? And are you the owner of the application?&lt;/P&gt;&lt;P&gt;Can you share your code you're using? I recently did this &lt;A href="https://community.esri.com/t5/arcgis-online-questions/how-to-get-credit-usage-by-an-application-using/m-p/1105544/highlight/true#M42477" target="_blank"&gt;in another post&lt;/A&gt; and didn't see any errors.&lt;/P&gt;</description>
    <pubDate>Tue, 19 Oct 2021 14:17:46 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2021-10-19T14:17:46Z</dc:date>
    <item>
      <title>How to access the application usage using appId and secret (programmatically)?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-access-the-application-usage-using-appid/m-p/1108805#M31333</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;I have been trying to access the application usage using Python.&lt;BR /&gt;I have &lt;STRONG&gt;appId&lt;/STRONG&gt; and &lt;STRONG&gt;app secret&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;The steps that I have been following:&lt;/P&gt;&lt;P&gt;1. Using app ID and secret to get an access token (using &lt;SPAN&gt;https://&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/root.htm" target="_blank" rel="noopener"&gt;[root]&lt;/A&gt;&lt;SPAN&gt;/oauth2/token url&lt;/SPAN&gt;)&lt;BR /&gt;2. Using access token to generate the token (using &lt;SPAN&gt;https://&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/root.htm" target="_blank" rel="noopener"&gt;[root]&lt;/A&gt;&lt;SPAN&gt;/generateToken&lt;/SPAN&gt;&lt;SPAN class=""&gt;(POST only)&lt;/SPAN&gt;). The parameters that are being passed are - token, serverURL, client and referer.&lt;BR /&gt;&lt;BR /&gt;and passing the token in the usage url&lt;BR /&gt;The result I'm getting -&amp;nbsp;&lt;BR /&gt;b'{"error":{"code":403,"messageCode":"GWM_0003","message":"You do not have permissions to access this resource or perform this operation.","details":[]}}'&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 13:37:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-access-the-application-usage-using-appid/m-p/1108805#M31333</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-10-19T13:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to access the application usage using appId and secret (programmatically)?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-access-the-application-usage-using-appid/m-p/1108818#M31334</link>
      <description>&lt;P&gt;What is your role in your org? And are you the owner of the application?&lt;/P&gt;&lt;P&gt;Can you share your code you're using? I recently did this &lt;A href="https://community.esri.com/t5/arcgis-online-questions/how-to-get-credit-usage-by-an-application-using/m-p/1105544/highlight/true#M42477" target="_blank"&gt;in another post&lt;/A&gt; and didn't see any errors.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 14:17:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-access-the-application-usage-using-appid/m-p/1108818#M31334</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-10-19T14:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to access the application usage using appId and secret (programmatically)?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-access-the-application-usage-using-appid/m-p/1109614#M31359</link>
      <description>&lt;P&gt;I'm the administrator in the organization and the application is shared with the organization.&lt;BR /&gt;Please find below the snippet I am using to generate token:&lt;/P&gt;&lt;P&gt;## create access token&lt;/P&gt;&lt;P&gt;url = "&lt;A href="https://cssl.maps.arcgis.com/sharing/rest/oauth2/token" target="_blank"&gt;https://cssl.maps.arcgis.com/sharing/rest/oauth2/token&lt;/A&gt;"&lt;BR /&gt;params = {'grant_type': 'client_credentials',&lt;BR /&gt;'client_id': &amp;lt;client id&amp;gt;,&lt;BR /&gt;'client_secret': &amp;lt;client secret&amp;gt;,&lt;BR /&gt;'expiration': 1440}&lt;/P&gt;&lt;P&gt;response = requests.post(url, data=params)&lt;BR /&gt;access_token = response.json()['access_token']&lt;/P&gt;&lt;P&gt;## generate token using access token&lt;/P&gt;&lt;P&gt;token_url = "&lt;A href="https://cssl.maps.arcgis.com/sharing/rest/generateToken" target="_blank"&gt;https://cssl.maps.arcgis.com/sharing/rest/generateToken&lt;/A&gt;"&lt;BR /&gt;params2 = {'request': 'getToken',&lt;BR /&gt;'token': access_token,&lt;BR /&gt;'client': 'referer',&lt;BR /&gt;'referer': '&lt;A href="https://cssl.maps.arcgis.com" target="_blank"&gt;https://cssl.maps.arcgis.com&lt;/A&gt;',&lt;BR /&gt;'serverURL': '&lt;A href="https://cssl.maps.arcgis.com" target="_blank"&gt;https://cssl.maps.arcgis.com&lt;/A&gt;',&lt;BR /&gt;'f': 'json'}&lt;/P&gt;&lt;P&gt;resp = requests.post(token_url, data=params2)&lt;BR /&gt;my_token = resp.json()['token']&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Vaibhav&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 10:40:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-access-the-application-usage-using-appid/m-p/1109614#M31359</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-10-21T10:40:23Z</dc:date>
    </item>
  </channel>
</rss>

