<?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: Update item properties reset back to no value (null) in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/update-item-properties-reset-back-to-no-value-null/m-p/806958#M2309</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I noticed that None or empty string doesn't make any changes to the item when updated as well.&amp;nbsp;I think is due &lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/update-item.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;REST api&lt;/A&gt; behavior which has a parameter to set when clearing fields is applied (clearEmptyFields) and I cannot find that from the Python API.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I gave it a go and tried if I can get the removing values working and it looks like following actually works. It will use the update endpoint and set description to empty.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; requests
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; json

call &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'http://{}/sharing/rest/content/users/{}/items/{}/update?f=json&amp;amp;token={}&amp;amp;description=&amp;amp;clearEmptyFields=True'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
            gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;properties&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;urlKey &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"."&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;properties&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;customBaseUrl&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
            gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;users&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;me&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;username&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
            copy_to_item&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;id&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
            gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;_con&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;token&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

request &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; requests&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;post&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;call&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
json_data &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; json&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;loads&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;request&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;text&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
json_data
&lt;SPAN class="comment token"&gt;# {'success': True, 'id': 'db9db040d6184e989e1aac253df840cb'}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's a bit weird that the ArcGIS Python API doesn't support this out of the box. Or if it does, it would be nice to know since I couldn't figure it out.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 09:24:53 GMT</pubDate>
    <dc:creator>AnttiKajanus</dc:creator>
    <dc:date>2021-12-12T09:24:53Z</dc:date>
    <item>
      <title>Update item properties reset back to no value (null)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/update-item-properties-reset-back-to-no-value-null/m-p/806957#M2308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm building a test script that will change an item's property value (accessInformation), and then reset that property back to no value (Null) in the ArcGIS API for Python. I've tried passing None/False into the dict to update with no luck. Even a empty string would be favorable then my current workaround ("Null")&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/475317_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Dec 2019 20:51:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/update-item-properties-reset-back-to-no-value-null/m-p/806957#M2308</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-12-04T20:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: Update item properties reset back to no value (null)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/update-item-properties-reset-back-to-no-value-null/m-p/806958#M2309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I noticed that None or empty string doesn't make any changes to the item when updated as well.&amp;nbsp;I think is due &lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/update-item.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;REST api&lt;/A&gt; behavior which has a parameter to set when clearing fields is applied (clearEmptyFields) and I cannot find that from the Python API.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I gave it a go and tried if I can get the removing values working and it looks like following actually works. It will use the update endpoint and set description to empty.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; requests
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; json

call &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'http://{}/sharing/rest/content/users/{}/items/{}/update?f=json&amp;amp;token={}&amp;amp;description=&amp;amp;clearEmptyFields=True'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
            gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;properties&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;urlKey &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"."&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;properties&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;customBaseUrl&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
            gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;users&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;me&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;username&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
            copy_to_item&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;id&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
            gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;_con&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;token&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

request &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; requests&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;post&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;call&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
json_data &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; json&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;loads&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;request&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;text&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
json_data
&lt;SPAN class="comment token"&gt;# {'success': True, 'id': 'db9db040d6184e989e1aac253df840cb'}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's a bit weird that the ArcGIS Python API doesn't support this out of the box. Or if it does, it would be nice to know since I couldn't figure it out.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:24:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/update-item-properties-reset-back-to-no-value-null/m-p/806958#M2309</guid>
      <dc:creator>AnttiKajanus</dc:creator>
      <dc:date>2021-12-12T09:24:53Z</dc:date>
    </item>
  </channel>
</rss>

