<?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: JSON responses for use with the Examples of ESRI interaction with Enterprise server information in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/json-responses-for-use-with-the-examples-of-esri/m-p/1388078#M9703</link>
    <description>&lt;P&gt;Good Day,&lt;/P&gt;&lt;P&gt;Unless I am mistaken..&amp;nbsp; this code is using the API. ??&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My hope is to get the appropriate connection process to interact with the Enterprise for any information I need.&amp;nbsp; I do want to get a list of services, users, groups, permissions... etc&amp;nbsp; The Excel sheet is a bonus... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; want to read and write as needed.&amp;nbsp; I just cannot get a clean connnection.&amp;nbsp; syntax encoding/parsing etc etc ..&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;-Steve&lt;/P&gt;</description>
    <pubDate>Wed, 28 Feb 2024 15:02:59 GMT</pubDate>
    <dc:creator>SGTomlins</dc:creator>
    <dc:date>2024-02-28T15:02:59Z</dc:date>
    <item>
      <title>JSON responses for use with the Examples of ESRI interaction with Enterprise server information</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/json-responses-for-use-with-the-examples-of-esri/m-p/1386194#M9678</link>
      <description>&lt;P&gt;I cannot seem to make any of the examples work on our enterprise setup.&amp;nbsp; I have added what I think was necessary to get past the parsing and the client and the request.&amp;nbsp; Formatting of things from str to bytes etc has been employed to satisfy my steps to the next error.&lt;/P&gt;&lt;P&gt;These sample/examples are a little "outdated" me thinks...&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://enterprise.arcgis.com/en/server/10.8/administer/windows/example-write-properties-of-all-services-to-a-csv-file.htm" target="_blank" rel="noopener"&gt;https://enterprise.arcgis.com/en/server/10.8/administer/windows/example-write-properties-of-all-services-to-a-csv-file.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://enterprise.arcgis.com/en/portal/10.8/administer/windows/example-add-members-to-the-portal.htm" target="_blank" rel="noopener"&gt;https://enterprise.arcgis.com/en/portal/10.8/administer/windows/example-add-members-to-the-portal.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The included code used the add member example as a starting point to work out communication between all parts...&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am stumped here now...&amp;nbsp; &amp;nbsp;like I said, each time I was able to reformat responses to move to the next part of the code, I bomb out again on something else...&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the error...&lt;/P&gt;&lt;P&gt;File "C:\SGT\ESRI\Python\ArcGIS Enterprise\AddUserToEntPortal-fumblethru.py", line 58, in generateToken&lt;BR /&gt;if responseJSON.has_key('error'):&lt;BR /&gt;AttributeError: 'dict' object has no attribute 'has_key'&lt;/P&gt;&lt;P&gt;Anyone have a working example of this...&amp;nbsp; please.. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#!/usr/bin/env python&lt;BR /&gt;# Requires Python 2.7+&lt;/P&gt;&lt;P&gt;# Demonstrates how to add users to the ArcGIS Enterprise portal in bulk&lt;/P&gt;&lt;P&gt;# For Http calls&lt;BR /&gt;import urllib3, urllib, json&lt;BR /&gt;import urllib.parse&lt;BR /&gt;import urllib.response&lt;BR /&gt;from urllib.request import urlopen&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;from notebook.notebookapp import raw_input&lt;/P&gt;&lt;P&gt;# This function connects to the portal and adds members to it from a collection&lt;BR /&gt;# def createUsers(username,password, portalUrl, provider,userParamsQ):&lt;BR /&gt;# ## these are the tinkerbell-az server credentials: DEVELOPMENT server&lt;BR /&gt;username = "siteadmin"&lt;BR /&gt;password = "CxrbWeFjT21udxf2sgsdfg$2mDWGQyPu2YyfdgxWSqaA"&lt;BR /&gt;portalUrl = "&lt;A href="https://tinkerbell-az.ci.janesville.wi.us/devportal" target="_blank" rel="noopener"&gt;https://tinkerbell-az.ci.janesville.wi.us/devportal&lt;/A&gt;"&lt;BR /&gt;serverUrl = "&lt;A href="https://tinkerbell-az.ci.janesville.wi.us/devserver/admin" target="_blank" rel="noopener"&gt;https://tinkerbell-az.ci.janesville.wi.us/devserver/admin&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# This function gets a token from the portal&lt;BR /&gt;#def generateToken(username, password, serverUrl, json_obj=None):&lt;BR /&gt;def generateToken(username, password, serverUrl):&lt;BR /&gt;parameters = urllib.parse.urlencode({'username' : username,&lt;BR /&gt;'password' : password,&lt;BR /&gt;'client' : 'referer',&lt;BR /&gt;'referer': portalUrl,&lt;BR /&gt;'expiration': 600,&lt;BR /&gt;'f' : 'json'})&lt;BR /&gt;pmans = parameters.encode('utf-8')&lt;BR /&gt;try:&lt;BR /&gt;#response = urllib3.urlopen(portalUrl + '/sharing/rest/generateToken?', parameters).read()&lt;BR /&gt;response = urllib.request.urlopen(serverUrl + '/generateToken?', pmans)&lt;BR /&gt;#response = urllib.request.urlopen(serverUrl + '/generateToken?', pmans).read()&lt;BR /&gt;responsestring = response.read().decode('utf-8')&lt;BR /&gt;json_obj = json.loads(responsestring)&lt;BR /&gt;#print('this is the response :' + json_obj)&lt;/P&gt;&lt;P&gt;except Exception as e:&lt;BR /&gt;#raise SystemExit( 'Unable to open the url %s/sharing/rest/generateToken' % (portalUrl))&lt;BR /&gt;raise SystemExit('Unable to open the url %s/' % (serverUrl))&lt;BR /&gt;# responseJSON = json.loads(response.strip(' \t\n\r'))&lt;/P&gt;&lt;P&gt;responseJSON = json.loads(responsestring)&lt;/P&gt;&lt;P&gt;#content = json.loads(r.decode('utf-8').replace('\n', ''))&lt;/P&gt;&lt;P&gt;# Log results&lt;BR /&gt;if responseJSON.has_key('error'):&lt;BR /&gt;errDict = responseJSON['error']&lt;BR /&gt;if int(errDict['code'])==498:&lt;BR /&gt;message = 'Token Expired. Getting new token... '&lt;BR /&gt;token = generateToken(username,password, serverUrl)&lt;BR /&gt;else:&lt;BR /&gt;message = 'Error Code: %s \n Message: %s' % (errDict['code'],&lt;BR /&gt;errDict['message'])&lt;BR /&gt;raise SystemExit(message)&lt;BR /&gt;token = responseJSON.get('token')&lt;BR /&gt;return token&lt;/P&gt;&lt;P&gt;print('...Connecting to ' + portalUrl)&lt;BR /&gt;token = generateToken(username,password, serverUrl)&lt;BR /&gt;print('...Adding users ')&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 13:23:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/json-responses-for-use-with-the-examples-of-esri/m-p/1386194#M9678</guid>
      <dc:creator>SGTomlins</dc:creator>
      <dc:date>2024-02-26T13:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: JSON responses for use with the Examples of ESRI interaction with Enterprise server information</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/json-responses-for-use-with-the-examples-of-esri/m-p/1387977#M9698</link>
      <description>&lt;P&gt;I'd like to clarify first, are you trying to get the information of all services using rest service? Have you tried using ArcGIS API for Python?&lt;/P&gt;&lt;P&gt;I have a git repo that lists all services using ArcGIS API for Python. It needs an administrator level. The output is an Excel that is based on my specifications.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 12:38:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/json-responses-for-use-with-the-examples-of-esri/m-p/1387977#M9698</guid>
      <dc:creator>AlexanderDanielPratama</dc:creator>
      <dc:date>2024-02-28T12:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: JSON responses for use with the Examples of ESRI interaction with Enterprise server information</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/json-responses-for-use-with-the-examples-of-esri/m-p/1388078#M9703</link>
      <description>&lt;P&gt;Good Day,&lt;/P&gt;&lt;P&gt;Unless I am mistaken..&amp;nbsp; this code is using the API. ??&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My hope is to get the appropriate connection process to interact with the Enterprise for any information I need.&amp;nbsp; I do want to get a list of services, users, groups, permissions... etc&amp;nbsp; The Excel sheet is a bonus... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; want to read and write as needed.&amp;nbsp; I just cannot get a clean connnection.&amp;nbsp; syntax encoding/parsing etc etc ..&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;-Steve&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 15:02:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/json-responses-for-use-with-the-examples-of-esri/m-p/1388078#M9703</guid>
      <dc:creator>SGTomlins</dc:creator>
      <dc:date>2024-02-28T15:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: JSON responses for use with the Examples of ESRI interaction with Enterprise server information</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/json-responses-for-use-with-the-examples-of-esri/m-p/1388083#M9704</link>
      <description>&lt;P&gt;I made this work..&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 15:07:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/json-responses-for-use-with-the-examples-of-esri/m-p/1388083#M9704</guid>
      <dc:creator>SGTomlins</dc:creator>
      <dc:date>2024-02-28T15:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: JSON responses for use with the Examples of ESRI interaction with Enterprise server information</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/json-responses-for-use-with-the-examples-of-esri/m-p/1388529#M9706</link>
      <description>&lt;P&gt;That's great!&amp;nbsp;&lt;/P&gt;&lt;P&gt;I never used a token, thanks in advance too that I can elaborate your works with mine in the future. Here is a previous of my work, if you want to look. I create a report from the portal and server regarding the service and items that have been published by all users. I have a different approach when signing in to the enterprise.&amp;nbsp; The enterprise I am using is 11.2 and ArcGIS pro 3.2.&lt;/P&gt;&lt;P&gt;Hope it helps you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Feb 2024 05:30:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/json-responses-for-use-with-the-examples-of-esri/m-p/1388529#M9706</guid>
      <dc:creator>AlexanderDanielPratama</dc:creator>
      <dc:date>2024-02-29T05:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: JSON responses for use with the Examples of ESRI interaction with Enterprise server information</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/json-responses-for-use-with-the-examples-of-esri/m-p/1390317#M9715</link>
      <description>&lt;P&gt;Thank you..&amp;nbsp; I will take a look at this.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards.&lt;/P&gt;&lt;P&gt;-Steve&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 13:31:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/json-responses-for-use-with-the-examples-of-esri/m-p/1390317#M9715</guid>
      <dc:creator>SGTomlins</dc:creator>
      <dc:date>2024-03-04T13:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: JSON responses for use with the Examples of ESRI interaction with Enterprise server information</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/json-responses-for-use-with-the-examples-of-esri/m-p/1390453#M9717</link>
      <description>&lt;P&gt;I looked at this and using PyCharm, I was able to get things running and reporting.&amp;nbsp; I discovered that I did not have any ogc services running. The report service .py kept erroring out.&amp;nbsp; I commented the code for the&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;df_ogc = pd.concat(list_ogc_service).reset_index().drop(columns=['index'])&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;and&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;df_ogc.to_excel(writer, sheet_name='OGC Server')&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;then I got it to run.&amp;nbsp; When I get some OGC services running I will uncomment those lines.&lt;/P&gt;&lt;P&gt;Thank you again.&amp;nbsp; The reports are useful.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;-Steve&lt;/P&gt;&lt;P&gt;P.S. I will still pursue a remedy for my json stuff...&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 04 Mar 2024 15:58:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/json-responses-for-use-with-the-examples-of-esri/m-p/1390453#M9717</guid>
      <dc:creator>SGTomlins</dc:creator>
      <dc:date>2024-03-04T15:58:36Z</dc:date>
    </item>
  </channel>
</rss>

