<?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: Management Zone list through API in Dynatrace API</title>
    <link>https://community.dynatrace.com/t5/Dynatrace-API/Management-Zone-list-through-API/m-p/256828#M3394</link>
    <description>&lt;P&gt;You'll find more information on the links I provided above &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Either way, here's a quick example of a python script to list management zones from a given environment using V2 API. You'll need to generate an access token with "Read Settings" v2 permissions:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PedroSantos_1-1727089494450.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/22801i3501B316B5A88E46/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PedroSantos_1-1727089494450.png" alt="PedroSantos_1-1727089494450.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PedroSantos_2-1727089519891.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/22802i7DD1BB8149C39DB4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PedroSantos_2-1727089519891.png" alt="PedroSantos_2-1727089519891.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PedroSantos_0-1727089294786.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/22800i66F7C9494D464674/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PedroSantos_0-1727089294786.png" alt="PedroSantos_0-1727089294786.png" /&gt;&lt;/span&gt;&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;&lt;LI-CODE lang="python"&gt;import requests

# Dynatrace API endpoint and credentials
DT_API_TOKEN = '&amp;lt;Insert your token here&amp;gt;'

 # environment id looks similar to , for e.g., abc12345 (the part that comes before the .live.dynatrace.com on the link)
URL = f'https://{environmentid}.live.dynatrace.com/api/v2/settings/objects'

# Headers
headers = {
    'Authorization': f'Api-Token {DT_API_TOKEN}',
    'Content-Type': 'application/json'
}

# Query params for the Management Zones schema
params = {
    'schemaIds': 'builtin:management-zones',
    'pageSize': 100
}

# Fetch management zones
response = requests.get(URL, headers=headers, params=params)

# Check if the response was successful
if response.status_code == 200:
    management_zones = response.json().get('items', [])
    for zone in management_zones:
        print(f"Management Zone: {zone['value']['name']} (ID: {zone['objectId']})")
else:
    print(f"Error fetching management zones: {response.status_code} - {response.text}")&lt;/LI-CODE&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;&lt;P&gt;Let me know if this works for solving your problem &lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/80990"&gt;@CrazyHarry&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 23 Sep 2024 11:10:42 GMT</pubDate>
    <dc:creator>PedroSantos</dc:creator>
    <dc:date>2024-09-23T11:10:42Z</dc:date>
    <item>
      <title>Management Zone list through API</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Management-Zone-list-through-API/m-p/256644#M3389</link>
      <description>&lt;P&gt;Looking for a way to get a list of the Management Zones via the API.&lt;/P&gt;
&lt;P&gt;Another option would be from the GUI.&amp;nbsp; If a path to that functionality can be provided.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is a large numeric value that is used in query request to specify the MZ.&amp;nbsp; &amp;nbsp;I would like to get a list of those.&lt;/P&gt;
&lt;P&gt;Thanks all&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2024 06:27:54 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Management-Zone-list-through-API/m-p/256644#M3389</guid>
      <dc:creator>CrazyHarry</dc:creator>
      <dc:date>2024-09-24T06:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Management Zone list through API</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Management-Zone-list-through-API/m-p/256647#M3390</link>
      <description>&lt;P&gt;Hello.&lt;BR /&gt;You can either use the&amp;nbsp;&lt;A href="https://docs.dynatrace.com/docs/dynatrace-api/configuration-api/management-zones-api" target="_self"&gt;Management Zone API (V1)&lt;/A&gt; or, in the new API v2, the &lt;STRONG&gt;builtin:management-zones &lt;/STRONG&gt;schema Id, you can find info about it &lt;A href="https://docs.dynatrace.com/docs/dynatrace-api/environment-api/settings/schemas" target="_self"&gt;here.&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 17:18:34 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Management-Zone-list-through-API/m-p/256647#M3390</guid>
      <dc:creator>PedroSantos</dc:creator>
      <dc:date>2024-09-20T17:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: Management Zone list through API</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Management-Zone-list-through-API/m-p/256651#M3392</link>
      <description>&lt;P&gt;I'm not seeing that option in the Docs.&amp;nbsp; &amp;nbsp;Can you post an example of the api request here please?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 18:12:56 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Management-Zone-list-through-API/m-p/256651#M3392</guid>
      <dc:creator>CrazyHarry</dc:creator>
      <dc:date>2024-09-20T18:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Management Zone list through API</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Management-Zone-list-through-API/m-p/256828#M3394</link>
      <description>&lt;P&gt;You'll find more information on the links I provided above &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Either way, here's a quick example of a python script to list management zones from a given environment using V2 API. You'll need to generate an access token with "Read Settings" v2 permissions:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PedroSantos_1-1727089494450.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/22801i3501B316B5A88E46/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PedroSantos_1-1727089494450.png" alt="PedroSantos_1-1727089494450.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PedroSantos_2-1727089519891.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/22802i7DD1BB8149C39DB4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PedroSantos_2-1727089519891.png" alt="PedroSantos_2-1727089519891.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PedroSantos_0-1727089294786.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/22800i66F7C9494D464674/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PedroSantos_0-1727089294786.png" alt="PedroSantos_0-1727089294786.png" /&gt;&lt;/span&gt;&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;&lt;LI-CODE lang="python"&gt;import requests

# Dynatrace API endpoint and credentials
DT_API_TOKEN = '&amp;lt;Insert your token here&amp;gt;'

 # environment id looks similar to , for e.g., abc12345 (the part that comes before the .live.dynatrace.com on the link)
URL = f'https://{environmentid}.live.dynatrace.com/api/v2/settings/objects'

# Headers
headers = {
    'Authorization': f'Api-Token {DT_API_TOKEN}',
    'Content-Type': 'application/json'
}

# Query params for the Management Zones schema
params = {
    'schemaIds': 'builtin:management-zones',
    'pageSize': 100
}

# Fetch management zones
response = requests.get(URL, headers=headers, params=params)

# Check if the response was successful
if response.status_code == 200:
    management_zones = response.json().get('items', [])
    for zone in management_zones:
        print(f"Management Zone: {zone['value']['name']} (ID: {zone['objectId']})")
else:
    print(f"Error fetching management zones: {response.status_code} - {response.text}")&lt;/LI-CODE&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;&lt;P&gt;Let me know if this works for solving your problem &lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/80990"&gt;@CrazyHarry&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 11:10:42 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Management-Zone-list-through-API/m-p/256828#M3394</guid>
      <dc:creator>PedroSantos</dc:creator>
      <dc:date>2024-09-23T11:10:42Z</dc:date>
    </item>
  </channel>
</rss>

