<?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: Portal Admin Machines REST in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007044#M3630</link>
    <description>&lt;P&gt;would you want to do this with requests or the rest api for python?&lt;/P&gt;</description>
    <pubDate>Fri, 04 Dec 2020 19:06:11 GMT</pubDate>
    <dc:creator>DavidPike</dc:creator>
    <dc:date>2020-12-04T19:06:11Z</dc:date>
    <item>
      <title>Portal Admin Machines REST</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1006866#M3628</link>
      <description>&lt;P&gt;We need to be able to query the REST end point for the portal machines to determine the primary and standby machines but not sure what the syntax needs to be for accessing it outside the portal administrator.&lt;/P&gt;&lt;P data-unlink="true"&gt;The REST end point is&amp;nbsp;https://admin.portal...../arcgis/portaladmin/machines?f=pjson&amp;nbsp;&amp;nbsp;which works when I am in the portal admin but how do we add this to an external application with credentials / token?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 03:00:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1006866#M3628</guid>
      <dc:creator>DeanHowell1</dc:creator>
      <dc:date>2020-12-04T03:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Portal Admin Machines REST</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007044#M3630</link>
      <description>&lt;P&gt;would you want to do this with requests or the rest api for python?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 19:06:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007044#M3630</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-12-04T19:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: Portal Admin Machines REST</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007142#M3631</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;Thanks &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/167692"&gt;@DavidPike&lt;/a&gt;&amp;nbsp;we are looking to do as a request from an external script that needs to shut down the portal in a specific order depending on the machine status in HA&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/167692"&gt;@DavidPike&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;would you want to do this with requests or the rest api for python?&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Dec 2020 06:01:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007142#M3631</guid>
      <dc:creator>DeanHowell1</dc:creator>
      <dc:date>2020-12-05T06:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: Portal Admin Machines REST</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007155#M3632</link>
      <description>&lt;P&gt;gotcha, so you'd want to do a health check via the REST API&amp;nbsp;&lt;A href="https://developers.arcgis.com/rest/enterprise-administration/portal/health-check-portal.htm" target="_blank"&gt;Health Check—ArcGIS REST API | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;but need to know how to generate and attach the token for access?&lt;/P&gt;</description>
      <pubDate>Sat, 05 Dec 2020 12:06:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007155#M3632</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-12-05T12:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: Portal Admin Machines REST</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007187#M3633</link>
      <description>&lt;P&gt;Yes exactly. We are stuck on how to create and pass the relevant credentials through to the rest end point&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Dec 2020 23:25:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007187#M3633</guid>
      <dc:creator>DeanHowell1</dc:creator>
      <dc:date>2020-12-05T23:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: Portal Admin Machines REST</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007189#M3634</link>
      <description>&lt;P&gt;I think the health check doesn't require a toke&amp;nbsp; give the url a try.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Dec 2020 00:27:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007189#M3634</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-12-06T00:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Portal Admin Machines REST</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007247#M3635</link>
      <description>&lt;P&gt;Thanks again&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/167692"&gt;@DavidPike&lt;/a&gt;, yes the healthCheck works without a token but it is the machines that I need to query but have just found the help page for the machines which might give some greater insight&amp;nbsp;&lt;A href="https://developers.arcgis.com/rest/enterprise-administration/portal/status.htm" target="_blank"&gt;https://developers.arcgis.com/rest/enterprise-administration/portal/status.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Dec 2020 23:05:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007247#M3635</guid>
      <dc:creator>DeanHowell1</dc:creator>
      <dc:date>2020-12-06T23:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: Portal Admin Machines REST</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007323#M3636</link>
      <description>&lt;P&gt;ah gotcha,&lt;/P&gt;&lt;P&gt;So the initial query is to get the machine names:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://machine.domain.com/webadaptor/portaladmin/machines" target="_blank"&gt;https://machine.domain.com/webadaptor/portaladmin/machines&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;then the status for each machine:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://machine.domain.com/webadaptor/portaladmin/machines/status/MACHINE.DOMAIN.COM?f=json" target="_blank"&gt;https://machine.domain.com/webadaptor/portaladmin/machines/status/MACHINE.DOMAIN.COM?f=json&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;the token is generated with:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import requests


portalUrl = "https://domain/portal"
username = 'username'
password = "password"


def generateToken(username, password, portalUrl):
    # Retrieves a token to be used with API requests.
    headers = {'content-type': 'application/x-www-form-urlencoded'}
    parameters = {'username': username,
                  'password': password,
                  'client': 'referer',
                  'referer': portalUrl,
                  'expiration': 60,
                  'f': 'json'}
    url = portalUrl + '/sharing/rest/generateToken?'
    response = requests.post(url, data=parameters, headers=headers)

    try:
        jsonResponse = response.json()
        
        if 'token' in jsonResponse:
            return jsonResponse['token']
        elif 'error' in jsonResponse:
            print (jsonResponse['error']['message'])
            for detail in jsonResponse['error']['details']:
                print (detail)
    except ValueError:
        print('An unspecified error occurred.')
        print(ValueError)


        
token = generateToken(username, password, portalUrl)
print(token)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 07 Dec 2020 12:04:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007323#M3636</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-12-07T12:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Portal Admin Machines REST</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007324#M3637</link>
      <description>&lt;P&gt;then any url GETs will just be appended with:&lt;/P&gt;&lt;P&gt;"&amp;amp;token=" + token&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 12:06:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007324#M3637</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-12-07T12:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: Portal Admin Machines REST</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007543#M3641</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/167692"&gt;@DavidPike&lt;/a&gt;&amp;nbsp;once again very much appreciated.&lt;/P&gt;&lt;P&gt;Does the token need to be generated for the specific page / URL that you are trying to access or just for the portal?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 21:35:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007543#M3641</guid>
      <dc:creator>DeanHowell1</dc:creator>
      <dc:date>2020-12-07T21:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: Portal Admin Machines REST</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007547#M3642</link>
      <description>&lt;P&gt;did it work for you?&lt;/P&gt;&lt;P&gt;The token will last until it expires (in my example 60 minutes) and can be used for any query and doesn't need to be regenerated for a new query (if not expired of course).&lt;/P&gt;&lt;P&gt;You can also encode the token in a json request, but I get to the stage with this stuff that I'm happy if anything just works.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 21:43:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007547#M3642</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-12-07T21:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Portal Admin Machines REST</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007556#M3643</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/167692"&gt;@DavidPike&lt;/a&gt;&amp;nbsp;that is working, almost as it looks like we have some firewall issues &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 22:25:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007556#M3643</guid>
      <dc:creator>DeanHowell1</dc:creator>
      <dc:date>2020-12-07T22:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Portal Admin Machines REST</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007581#M3644</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/167692"&gt;@DavidPike&lt;/a&gt;&amp;nbsp;I have been told that there is a proxy in place and that could be causing the issue of not being able to get the results I need. Do you know how to use the proxy&amp;nbsp;&lt;A href="https://cls-bx-proxy" target="_blank"&gt;https://cls-bx-proxy&lt;/A&gt;&amp;nbsp;with what you have suggested above?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 00:44:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007581#M3644</guid>
      <dc:creator>DeanHowell1</dc:creator>
      <dc:date>2020-12-08T00:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: Portal Admin Machines REST</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007584#M3645</link>
      <description>&lt;P&gt;can you elaborate on the issue?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 00:57:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007584#M3645</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-12-08T00:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: Portal Admin Machines REST</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007590#M3646</link>
      <description>&lt;P&gt;I am getting a token returned using the script but I then get a 'Forbidden 403' message. So it has been suggested to use the proxy server but not sure how to configure that into the script.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DeanHowell1_0-1607391496930.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/1649i99925E8BABCA64BE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DeanHowell1_0-1607391496930.png" alt="DeanHowell1_0-1607391496930.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 01:39:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/portal-admin-machines-rest/m-p/1007590#M3646</guid>
      <dc:creator>DeanHowell1</dc:creator>
      <dc:date>2020-12-08T01:39:43Z</dc:date>
    </item>
  </channel>
</rss>

