<?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 api key.update(privileges=new_privileges) results in &amp;quot;Exception: Unable to update app. No update params specified. (Error Code: 500)&amp;quot; in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/api-key-update-privileges-new-privileges-results/m-p/1125100#M6891</link>
    <description>&lt;P&gt;I'm trying to update the privileges for one of my API keys using Python but I'm getting this stack trace and error message:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "upload_shapefile_to_arc_as_feature.py", line 27, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; api_key.update(http_referers=[], privileges=api_key_privileges)&lt;BR /&gt;&amp;nbsp; File "/home/account_name/.local/lib/python3.6/site-packages/arcgis/gis/_impl/_apikeys.py", line 161, in update&lt;BR /&gt;&amp;nbsp; &amp;nbsp; return self._gis._con.post(url, params)&lt;BR /&gt;&amp;nbsp; File "/home/account_name/.local/lib/python3.6/site-packages/arcgis/gis/_impl/_con/_connection.py", line 1079, in post&lt;BR /&gt;&amp;nbsp; &amp;nbsp; force_bytes=kwargs.pop("force_bytes", False),&lt;BR /&gt;&amp;nbsp; File "/home/account_name/.local/lib/python3.6/site-packages/arcgis/gis/_impl/_con/_connection.py", line 625, in _handle_response&lt;BR /&gt;&amp;nbsp; &amp;nbsp; self._handle_json_error(data["error"], errorcode)&lt;BR /&gt;&amp;nbsp; File "/home/account_name/.local/lib/python3.6/site-packages/arcgis/gis/_impl/_con/_connection.py", line 648, in _handle_json_error&lt;BR /&gt;&amp;nbsp; &amp;nbsp; raise Exception(errormessage)&lt;/P&gt;&lt;P&gt;Exception: Unable to update app.&lt;BR /&gt;No update params specified&lt;BR /&gt;(Error Code: 500)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's some code to recreate:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
USERNAME = ""
PASSWORD = ""
API_KEY = ""
ITEM_ID_TO_GIVE_PRIVILEGE_FOR = ""
PRIVILEGE_TO_ADD = f'portal:app:access:item:{ITEM_ID_TO_GIVE_PRIVILEGE_FOR}'

gis = GIS(username=USERNAME , password=PASSWORD )
api_key = gis.api_keys.get(API_KEY )
api_key_privileges = api_key.properties.privileges
api_key_privileges.concat(PRIVILEGE_TO_ADD)
api_key.update(privileges=api_key_privileges)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The documentation link for the method I'm trying to use is &lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis._impl.APIKey.update" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Any help would be appreciated!&lt;/P&gt;</description>
    <pubDate>Sat, 18 Dec 2021 00:25:39 GMT</pubDate>
    <dc:creator>NoahInada</dc:creator>
    <dc:date>2021-12-18T00:25:39Z</dc:date>
    <item>
      <title>api key.update(privileges=new_privileges) results in "Exception: Unable to update app. No update params specified. (Error Code: 500)"</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/api-key-update-privileges-new-privileges-results/m-p/1125100#M6891</link>
      <description>&lt;P&gt;I'm trying to update the privileges for one of my API keys using Python but I'm getting this stack trace and error message:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "upload_shapefile_to_arc_as_feature.py", line 27, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; api_key.update(http_referers=[], privileges=api_key_privileges)&lt;BR /&gt;&amp;nbsp; File "/home/account_name/.local/lib/python3.6/site-packages/arcgis/gis/_impl/_apikeys.py", line 161, in update&lt;BR /&gt;&amp;nbsp; &amp;nbsp; return self._gis._con.post(url, params)&lt;BR /&gt;&amp;nbsp; File "/home/account_name/.local/lib/python3.6/site-packages/arcgis/gis/_impl/_con/_connection.py", line 1079, in post&lt;BR /&gt;&amp;nbsp; &amp;nbsp; force_bytes=kwargs.pop("force_bytes", False),&lt;BR /&gt;&amp;nbsp; File "/home/account_name/.local/lib/python3.6/site-packages/arcgis/gis/_impl/_con/_connection.py", line 625, in _handle_response&lt;BR /&gt;&amp;nbsp; &amp;nbsp; self._handle_json_error(data["error"], errorcode)&lt;BR /&gt;&amp;nbsp; File "/home/account_name/.local/lib/python3.6/site-packages/arcgis/gis/_impl/_con/_connection.py", line 648, in _handle_json_error&lt;BR /&gt;&amp;nbsp; &amp;nbsp; raise Exception(errormessage)&lt;/P&gt;&lt;P&gt;Exception: Unable to update app.&lt;BR /&gt;No update params specified&lt;BR /&gt;(Error Code: 500)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's some code to recreate:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
USERNAME = ""
PASSWORD = ""
API_KEY = ""
ITEM_ID_TO_GIVE_PRIVILEGE_FOR = ""
PRIVILEGE_TO_ADD = f'portal:app:access:item:{ITEM_ID_TO_GIVE_PRIVILEGE_FOR}'

gis = GIS(username=USERNAME , password=PASSWORD )
api_key = gis.api_keys.get(API_KEY )
api_key_privileges = api_key.properties.privileges
api_key_privileges.concat(PRIVILEGE_TO_ADD)
api_key.update(privileges=api_key_privileges)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The documentation link for the method I'm trying to use is &lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis._impl.APIKey.update" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Any help would be appreciated!&lt;/P&gt;</description>
      <pubDate>Sat, 18 Dec 2021 00:25:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/api-key-update-privileges-new-privileges-results/m-p/1125100#M6891</guid>
      <dc:creator>NoahInada</dc:creator>
      <dc:date>2021-12-18T00:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: api key.update(privileges=new_privileges) results in "Exception: Unable to update app. No update params specified. (Error Code: 500)"</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/api-key-update-privileges-new-privileges-results/m-p/1127687#M6928</link>
      <description>&lt;P&gt;The issue was that there was a typo in the arcgis package source code. It's in my Python39/Lib/site-packages/arcgis/gis/_impl/_apikeys.py file, at line 159. It used to be:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;params&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;priveleges&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;privileges&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;and changing it to&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;params&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;privileges&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;privileges&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;makes it work.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 17:25:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/api-key-update-privileges-new-privileges-results/m-p/1127687#M6928</guid>
      <dc:creator>NoahInada</dc:creator>
      <dc:date>2021-12-20T17:25:09Z</dc:date>
    </item>
  </channel>
</rss>

