<?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: Accessing the Field Maps Designer App Settings using the Python API in ArcGIS Field Maps Questions</title>
    <link>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1343044#M7271</link>
    <description>&lt;P&gt;Hi Justin - I'm trying to leverage the form layouts from Field Maps Designer in a ExB custom widget edit interface.&amp;nbsp; In your experience can I get at the form definition through the resources interface you cite?&lt;/P&gt;&lt;P&gt;Thanks in advance for any guidance you can lend.&lt;/P&gt;&lt;P&gt;-Phil Ponce, PE&lt;/P&gt;</description>
    <pubDate>Sat, 28 Oct 2023 15:08:22 GMT</pubDate>
    <dc:creator>PhilPonce</dc:creator>
    <dc:date>2023-10-28T15:08:22Z</dc:date>
    <item>
      <title>Accessing the Field Maps Designer App Settings using the Python API</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1289843#M6029</link>
      <description>&lt;P&gt;Hello, is it possible to configure the Field Maps settings shown below using the Python API? If so, is there any documentation available on how to do it?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MarkEastwood_0-1684274202477.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/70861iF9C3768B40048C43/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MarkEastwood_0-1684274202477.png" alt="MarkEastwood_0-1684274202477.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2023 21:58:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1289843#M6029</guid>
      <dc:creator>MarkEastwood</dc:creator>
      <dc:date>2023-05-16T21:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing the Field Maps Designer App Settings using the Python API</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1290226#M6035</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;This is a great question and the answer to the question is yes, you can update the settings using the ArcGIS API for Python and by extension using the ArcGIS REST API.&lt;BR /&gt;&lt;BR /&gt;As far as I can tell, this is not publicly documented anywhere; so you heard it here first.&lt;/P&gt;&lt;H3&gt;Where are these settings stored?&lt;/H3&gt;&lt;P&gt;The Field Maps app settings are not stored with the map's definition.&amp;nbsp; So you won't be able to get them or set them using AGO Assistant or the by accessing the web map objects definition using the ArcGIS Python API.&lt;/P&gt;&lt;P&gt;You may be surprised to learn, as was I, that Portal/AGO items can have resources.&amp;nbsp; These resources are files of various types (J&lt;SPAN&gt;SON, XML, TXT, PNG, JPEG, GIF, BMP, PDF, MP3, MP4, and ZIP).&amp;nbsp; As far as I'm am aware, you can not access these resource files in the UI, it is all run behind the scenes.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;EM&gt;Resources&lt;/EM&gt; is a property of an item.&amp;nbsp; You can add, export, get, list, remove, or update these resource files.&lt;/P&gt;&lt;P&gt;The settings in question are stored in a file named&amp;nbsp;&lt;U&gt;field-maps-settings.json&lt;/U&gt;.&lt;/P&gt;&lt;H3&gt;Accessing Item Resources&lt;/H3&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;"An&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Item&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;object in the GIS will often have binary or textual data provided in the form of resource files, and to manage these files we've introduced a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#resourcemanager" target="_blank" rel="noopener"&gt;ResourceManager&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;helper class. When an&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Item&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is initialized, this&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;ResourceManager&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;instance is created and stored as the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;resources&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;property of that&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Item. This property then provides access to a number of methods useful for viewing and modifying the files, including:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;list(),&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;get(),&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;add(),&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;update(),&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;remove()&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;export().&lt;/P&gt;&lt;P&gt;Users will generally not interact with the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;resources&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;property directly, nor will they create a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;ResourceManager&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;instance directly. Instead they will more often create classes and call methods which in turn initialize a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;ResourceManager&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;instance for a portal&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Item&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and leverage these methods under the hood.&lt;/P&gt;&lt;P&gt;While the adding, updating, and removal of these resource files should ideally be accomplished through safer, higher-level functions and interfaces, users might be interested in directly calling the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;list(),&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;get()&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;export()&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;methods directly. Let's take a look at how we can use these methods and what we should expect as a response."&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;H3&gt;Example&lt;/H3&gt;&lt;P&gt;Goal: Turn Layer Filters setting from "Off" to "All feature layers and fields".&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JustinReynolds_1-1684418973012.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/71076i3EBC12F9177D8601/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JustinReynolds_1-1684418973012.png" alt="JustinReynolds_1-1684418973012.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Issue encountered:&lt;/P&gt;&lt;P&gt;I would like to modify the file in place using the &lt;EM&gt;file_name&lt;/EM&gt; and &lt;EM&gt;text&lt;/EM&gt; parameters, but the Python API's update method for some reason requires the &lt;EM&gt;file&lt;/EM&gt; parameter, which means I also need a file on disk which I don't like.&amp;nbsp; Interestingly enough, the REST API does not require that.&amp;nbsp; Instead of using the update method my approach is to remove the existing file, then add it back with the new settings. The add method does not require a file on disk.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import json
from arcgis import GIS

FILENAME = 'field-maps-settings.json'
UPDATE_DICT = {'layerFilters': {'mode': 'all', 'layers': {}}}
MAP_ITEM_ID = 'f0a550fbe21f46cc9876dde4ea66fa1c' 
URL = 'https://&amp;lt;org&amp;gt;.maps.arcgis.com/'
USERNAME = 'item_owner_or_admin_username'
PASSWORD = 'thePassword'

portal = GIS(URL, USERNAME, PASSWORD)

map_item = portal.content.get(MAP_ITEM_ID)

if map_item:
    resources = map_item.resources.list()
    if resources:
        if any(d['resource'] == FILENAME for d in resources):
            app_settings = map_item.resources.get(FILENAME)
            if app_settings:
                # Replace the existing settings with the UPDATE_DICT settings
                for setting, value in UPDATE_DICT.items():
                    app_settings[setting] = value
                
                # convert app_settings to JSON string
                new_settings = str(json.dumps(app_settings)) 
                
                remove_result = map_item.resources.remove(FILENAME) # returns True or False
                if remove_result:
                    result = map_item.resources.add(file_name=FILENAME, text=new_settings)
                    print(result)
        else:
            print('The Web Map item does not have the resource you are seeking!')
    else:
        print('The Web Map item does not have resources!')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Learn more:&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#resourcemanager" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#resourcemanager&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/item-resources.htm" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/rest/users-groups-and-items/item-resources.htm&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/update-resources.htm" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/rest/users-groups-and-items/update-resources.htm&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/add-resources.htm" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/rest/users-groups-and-items/add-resources.htm&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/python/guide/accessing-item-resources/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/python/guide/accessing-item-resources/&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;H4&gt;&lt;SPAN&gt;Note:&lt;/SPAN&gt;&lt;/H4&gt;&lt;P&gt;&lt;SPAN&gt;When you click the "Save" button on the App Setting tab of Field Maps Designer, it is hitting the updateResource REST Endpoint with a payload of filename="&lt;U&gt;field-maps-settings.json&lt;/U&gt;" and text="{&amp;lt;all the settings&amp;gt;}", which falls inline with line 10 in the code snippet above.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 15:43:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1290226#M6035</guid>
      <dc:creator>JustinReynolds</dc:creator>
      <dc:date>2023-05-18T15:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing the Field Maps Designer App Settings using the Python API</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1290302#M6036</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/183291"&gt;@JustinReynolds&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thank you for providing such a comprehensive response.&lt;/P&gt;&lt;P&gt;I too was surprised that the app settings were not included in the maps definition, as well as the discovery of items having resources.&lt;/P&gt;&lt;P&gt;I plan to implement your suggestions within the next few days and will accept this as a solution once I have successfully executed the script.&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 19:13:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1290302#M6036</guid>
      <dc:creator>MarkEastwood</dc:creator>
      <dc:date>2023-05-17T19:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing the Field Maps Designer App Settings using the Python API</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1290412#M6048</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/183291"&gt;@JustinReynolds&lt;/a&gt;&amp;nbsp;- &lt;SPAN&gt;Have you successfully updated the field-maps-settings.json using the ArcGIS API for Python? I have been working on a script myself, but I'm encountering difficulties when attempting to update the field-maps-settings.json file.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 21:23:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1290412#M6048</guid>
      <dc:creator>MarkEastwood</dc:creator>
      <dc:date>2023-05-17T21:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing the Field Maps Designer App Settings using the Python API</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1290450#M6051</link>
      <description>&lt;P&gt;Hey Mark,&lt;/P&gt;&lt;P&gt;I'm working a script as well.&amp;nbsp; I will let you know how it goes.&amp;nbsp; If I have too many issues I will pass it to a real developer.&amp;nbsp; If worst comes to worst I'll use the REST API using python.&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 17:12:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1290450#M6051</guid>
      <dc:creator>JustinReynolds</dc:creator>
      <dc:date>2023-05-18T17:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing the Field Maps Designer App Settings using the Python API</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1290641#M6062</link>
      <description>&lt;P&gt;I modified the original reply.&amp;nbsp; Sorry for the nested if blocks. I refactored my code to make it less abstract for others.&amp;nbsp; It works pretty well.&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 14:53:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1290641#M6062</guid>
      <dc:creator>JustinReynolds</dc:creator>
      <dc:date>2023-05-18T14:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing the Field Maps Designer App Settings using the Python API</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1290694#M6066</link>
      <description>&lt;P&gt;Thanks so much for the effort you put into this.&lt;BR /&gt;&lt;BR /&gt;I did the same test, updating the&amp;nbsp;&lt;SPAN&gt;Turn Layer Filters setting from "Off" to "All feature layers and fields", and it worked great.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 16:37:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1290694#M6066</guid>
      <dc:creator>MarkEastwood</dc:creator>
      <dc:date>2023-05-18T16:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing the Field Maps Designer App Settings using the Python API</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1290758#M6069</link>
      <description>&lt;P&gt;While technically possible, I would be careful with editing these org-wide files and would recommend having a backup.&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 18:10:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1290758#M6069</guid>
      <dc:creator>DylanT_EsriCanada</dc:creator>
      <dc:date>2023-05-18T18:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing the Field Maps Designer App Settings using the Python API</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1290773#M6070</link>
      <description>&lt;P&gt;Hi Dylan,&lt;/P&gt;&lt;P&gt;Can you elaborate a bit more on what you mean by editing org-wide files? I'd like to understand the risks a bit more.&lt;BR /&gt;&lt;BR /&gt;The resource files in question are at the item level (specifically of a web map item), accessible to only the item owner or admin. It may or may not exist and merely hold easily replaceable config items relevant to only field maps.&amp;nbsp; These are the exact calls that happen in the Field Maps Designer UI to the REST API (addResource, removeResource, updateResource) when the "Save" button is clicked.&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 18:46:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1290773#M6070</guid>
      <dc:creator>JustinReynolds</dc:creator>
      <dc:date>2023-05-18T18:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing the Field Maps Designer App Settings using the Python API</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1343044#M7271</link>
      <description>&lt;P&gt;Hi Justin - I'm trying to leverage the form layouts from Field Maps Designer in a ExB custom widget edit interface.&amp;nbsp; In your experience can I get at the form definition through the resources interface you cite?&lt;/P&gt;&lt;P&gt;Thanks in advance for any guidance you can lend.&lt;/P&gt;&lt;P&gt;-Phil Ponce, PE&lt;/P&gt;</description>
      <pubDate>Sat, 28 Oct 2023 15:08:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/accessing-the-field-maps-designer-app-settings/m-p/1343044#M7271</guid>
      <dc:creator>PhilPonce</dc:creator>
      <dc:date>2023-10-28T15:08:22Z</dc:date>
    </item>
  </channel>
</rss>

