<?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: Python - Get the services layers used in a Portal Dashboard in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-get-the-services-layers-used-in-a-portal/m-p/1304790#M8838</link>
    <description>&lt;P&gt;Thank you Josh!&amp;nbsp; This code helped me a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 30 Jun 2023 09:27:23 GMT</pubDate>
    <dc:creator>Alex2</dc:creator>
    <dc:date>2023-06-30T09:27:23Z</dc:date>
    <item>
      <title>Python - Get the services layers used in a Portal Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-get-the-services-layers-used-in-a-portal/m-p/1304363#M8833</link>
      <description>&lt;P&gt;Hi there!&lt;/P&gt;&lt;P&gt;I'm trying to get all the services, layers, webmapps...etc, that are dependent between each other in my organization via python.&lt;/P&gt;&lt;P&gt;I can get this information of diferent elements using the method "dependent_upon()" and "dependent_to()", but it does not retrieve this information for some elements, such as Dasboards or some aplications.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to get which features services are consumed by a dashboard via python?&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2023 11:09:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/python-get-the-services-layers-used-in-a-portal/m-p/1304363#M8833</guid>
      <dc:creator>Alex2</dc:creator>
      <dc:date>2023-06-29T11:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: Python - Get the services layers used in a Portal Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-get-the-services-layers-used-in-a-portal/m-p/1304420#M8835</link>
      <description>&lt;P&gt;If you use the &lt;STRONG&gt;get_data&lt;/STRONG&gt; method on the dashboard Item, you can search through the JSON and find all referenced layers.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
import re

gis = GIS('your portal url')

# get dashboard json
dash = gis.content.get('itemid of dashboard').get_data()

# pull out all itemids of maps / data layers w/ regex; push unique values into list
matches =  []
[matches.append(m) for m in re.findall('[a-f0-9]{32}', str(dash)) if m not in matches]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once you have your &lt;STRONG&gt;matches&lt;/STRONG&gt; list, you can do other things with it, like pull the URLs or titles.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1688043979103.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/74492iF05E4F2F2EFB7083/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1688043979103.png" alt="jcarlson_0-1688043979103.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2023 13:09:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/python-get-the-services-layers-used-in-a-portal/m-p/1304420#M8835</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2023-06-29T13:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: Python - Get the services layers used in a Portal Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-get-the-services-layers-used-in-a-portal/m-p/1304790#M8838</link>
      <description>&lt;P&gt;Thank you Josh!&amp;nbsp; This code helped me a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2023 09:27:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/python-get-the-services-layers-used-in-a-portal/m-p/1304790#M8838</guid>
      <dc:creator>Alex2</dc:creator>
      <dc:date>2023-06-30T09:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: Python - Get the services layers used in a Portal Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-get-the-services-layers-used-in-a-portal/m-p/1478145#M10067</link>
      <description>&lt;P&gt;Hi! Sorry, joining the party very late.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would you mind explaining how that regex expression (in line 11 of your code) accesses the itemIds? I am still a python newb and so still struggle with regex, sorry if this is obvious.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Very much appreciate your help, thanks!&lt;/P&gt;&lt;PRE&gt;re.findall('[a-f0-9]{32}', str(dash))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2024 00:46:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/python-get-the-services-layers-used-in-a-portal/m-p/1478145#M10067</guid>
      <dc:creator>maya_fromstein</dc:creator>
      <dc:date>2024-05-24T00:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: Python - Get the services layers used in a Portal Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-get-the-services-layers-used-in-a-portal/m-p/1478146#M10068</link>
      <description>&lt;P&gt;You should check out regex101.com, it has loads of resources for understanding regex. But here's the plain English version.&lt;/P&gt;&lt;P&gt;[a-f0-9] : Match a single character from a-f or from 0 to 9. ItemIDs are hexidecimal, so they can have digits and the first 6 letters of the alphabet.&lt;/P&gt;&lt;P&gt;{32} : Whatever precedes this, match it 32 times.&lt;/P&gt;&lt;P&gt;So, it should find any 32-character line of text consisting of digits, a, b, c, d, e, or f. Which is an ItemID!&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2024 00:55:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/python-get-the-services-layers-used-in-a-portal/m-p/1478146#M10068</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-05-24T00:55:29Z</dc:date>
    </item>
  </channel>
</rss>

