<?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: Using administrative capabilities of ArcGIS Python API with a standalone AGS server in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/using-administrative-capabilities-of-arcgis-python/m-p/1345379#M9233</link>
    <description>&lt;P&gt;This seems relevant even though it is for Enterprise. Getting closer, but could still use help.&lt;BR /&gt;If I can get a token via POST, how do I use it with the ArcGIS Python API?&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://enterprise.arcgis.com/en/server/latest/administer/windows/acquiring-arcgis-tokens.htm" target="_blank" rel="noopener"&gt;https://enterprise.arcgis.com/en/server/latest/administer/windows/acquiring-arcgis-tokens.htm&lt;/A&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;BLOCKQUOTE&gt;&lt;H5&gt;Note:&lt;/H5&gt;&lt;P&gt;If there is a proxy server between the client application or browser and the &lt;SPAN class=""&gt;ArcGIS Server&lt;/SPAN&gt; site, tokens generated using the &lt;SPAN class=""&gt;IP Address&lt;/SPAN&gt; and &lt;SPAN class=""&gt;IP address of this request's origin&lt;/SPAN&gt; options must be bound to the IP address of the proxy server. If there are multiple load balancing proxy servers between the client application or browser and the &lt;SPAN class=""&gt;ArcGIS Server&lt;/SPAN&gt;, the &lt;SPAN class=""&gt;HTTP Referer&lt;/SPAN&gt; option should be used.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 03 Nov 2023 01:39:52 GMT</pubDate>
    <dc:creator>eMosby</dc:creator>
    <dc:date>2023-11-03T01:39:52Z</dc:date>
    <item>
      <title>Using administrative capabilities of ArcGIS Python API with a standalone AGS server</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/using-administrative-capabilities-of-arcgis-python/m-p/1344263#M9215</link>
      <description>&lt;P&gt;I am trying to use the ArcGIS API for Python (Python 3.9) to access admin capabilities of an unfederated ArcGIS (10.6.1) Site. The site is comprised of a multimachine deployment behind a single web adaptor. The site's web adaptor and associated AGS machines also sit behind a reverse proxy server.&lt;/P&gt;&lt;P&gt;This is my Python code to get a Server object:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis.server import Server
ags_url = 'https://webadaptor.domain.org/arcgis/admin'
server = Server(url=ags_url, username=user, password=password, verify_cert=False)&lt;/LI-CODE&gt;&lt;P&gt;The specific error that is blocking me is:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;"Unauthorized access. Token not found. You can generate a token using the 'generateToken' operation."&lt;/LI-CODE&gt;&lt;P&gt;I am passing valid ArcGIS Server credentials. I have also tried passing the '/arcgis/admin/generateToken' appended url to tokenurl and token_url as parameters (the docs/forum usage seems to vary)&lt;/P&gt;&lt;P&gt;In a browser, if I hit the generateToken endpoint (via html) with the credentials and the 'Request IP' &amp;lt;Client&amp;gt; parameter, I seem to receive a valid token:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="eMosby_0-1698813184357.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/84652i7DFD8735045D17BD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="eMosby_0-1698813184357.png" alt="eMosby_0-1698813184357.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;JSON response:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
  "token": "blahblahblalyjfkutrk8htdkhg-khfu4twujt73g0irsdkgjh",
  "expires": "1698816744485"
}&lt;/LI-CODE&gt;&lt;P&gt;Accordingly, I can access the admin endpoint and do various admin things from my machine in a browser using the same credentials.&lt;/P&gt;&lt;P&gt;In Python, I can successfully create a server object with the inputs stated, but it seems no administrative privileges are granted. The privileged properties return a stack trace error in my IDE. I can see the server version, etc. &amp;amp; ServiceDirectory of the site but nothing else.&lt;/P&gt;&lt;P&gt;I suspect that the reverse proxy server is somehow contributing to the token error, but I am at a loss as to how to rectify it.&lt;/P&gt;&lt;P&gt;How do I get a token to the API so that I can administer the site programmatically?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 05:01:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/using-administrative-capabilities-of-arcgis-python/m-p/1344263#M9215</guid>
      <dc:creator>eMosby</dc:creator>
      <dc:date>2023-11-01T05:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using administrative capabilities of ArcGIS Python API with a standalone AGS server</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/using-administrative-capabilities-of-arcgis-python/m-p/1345379#M9233</link>
      <description>&lt;P&gt;This seems relevant even though it is for Enterprise. Getting closer, but could still use help.&lt;BR /&gt;If I can get a token via POST, how do I use it with the ArcGIS Python API?&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://enterprise.arcgis.com/en/server/latest/administer/windows/acquiring-arcgis-tokens.htm" target="_blank" rel="noopener"&gt;https://enterprise.arcgis.com/en/server/latest/administer/windows/acquiring-arcgis-tokens.htm&lt;/A&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;BLOCKQUOTE&gt;&lt;H5&gt;Note:&lt;/H5&gt;&lt;P&gt;If there is a proxy server between the client application or browser and the &lt;SPAN class=""&gt;ArcGIS Server&lt;/SPAN&gt; site, tokens generated using the &lt;SPAN class=""&gt;IP Address&lt;/SPAN&gt; and &lt;SPAN class=""&gt;IP address of this request's origin&lt;/SPAN&gt; options must be bound to the IP address of the proxy server. If there are multiple load balancing proxy servers between the client application or browser and the &lt;SPAN class=""&gt;ArcGIS Server&lt;/SPAN&gt;, the &lt;SPAN class=""&gt;HTTP Referer&lt;/SPAN&gt; option should be used.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 03 Nov 2023 01:39:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/using-administrative-capabilities-of-arcgis-python/m-p/1345379#M9233</guid>
      <dc:creator>eMosby</dc:creator>
      <dc:date>2023-11-03T01:39:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using administrative capabilities of ArcGIS Python API with a standalone AGS server</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/using-administrative-capabilities-of-arcgis-python/m-p/1345566#M9236</link>
      <description>&lt;P&gt;Does this help at all?&amp;nbsp;&lt;A href="https://support.esri.com/en-us/knowledge-base/how-to-connect-to-a-standalone-arcgis-server-using-arcg-000021053" target="_blank"&gt;How To: Connect to a Standalone ArcGIS Server Using ArcGIS API for Python (esri.com)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2023 15:14:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/using-administrative-capabilities-of-arcgis-python/m-p/1345566#M9236</guid>
      <dc:creator>Dan_Brumm</dc:creator>
      <dc:date>2023-11-03T15:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using administrative capabilities of ArcGIS Python API with a standalone AGS server</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/using-administrative-capabilities-of-arcgis-python/m-p/1346508#M9248</link>
      <description>&lt;P&gt;Thanks for your reply. I had not seen that particular doc, but what it describes is what I have tried to do.&lt;/P&gt;&lt;P&gt;I believe my issue is that the parameters the generateToken function accepts (at least as enumerated therein) are only user and password. I suspect with our deployment architecture the username/password are not enough to generate a token and what is also needed is the 'request IP' (the proxy server's IP).&lt;BR /&gt;&lt;BR /&gt;In any case, now it seems I should probably try to get a token response via a separate REST call to the generateToken endpoint and pass it as a parameter to the Server() method, or attempt to pass the additional generateToken parameters here directly.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 04:50:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/using-administrative-capabilities-of-arcgis-python/m-p/1346508#M9248</guid>
      <dc:creator>eMosby</dc:creator>
      <dc:date>2023-11-07T04:50:03Z</dc:date>
    </item>
  </channel>
</rss>

