26 Jul 2024
11:06 AM
- last edited on
29 Jul 2024
08:18 AM
by
MaciejNeumann
Hi All,
Need your guidance on below Question:-
How to export Management Zone from Dynatrace. We have 800++ management zones.
Any idea to export Management Zones will be much appreciated
Mukesh
Solved! Go to Solution.
26 Jul 2024 12:57 PM
Hello,
You can use Dynatrace environment API v2, /settings/objects. and use builtin:management-zones in schemaIds.
This should help you export all your management zones.
Thanks,
Islam
26 Jul 2024 03:41 PM
Thanks for your response.
Can you please tell what are steps we need to take it?
Mukesh
26 Jul 2024 04:01 PM
Hi,
curl -X 'GET' \
'https://XXXXXXXX.live.dynatrace.com/api/v2/settings/objects?schemaIds=builtin%3Amanagement-zones&fields=objectId%2Cvalue&pageSize=500' \
-H 'accept: application/json; charset=utf-8' \
-H 'Authorization: Api-Token XXXXXXXX'
That will provide first chunk with 500 MZ in your tenant.
It would provide an ID, in the body, to make a similar call with next chunk. That API return 500 entities as maximum in one shot.
Bets regards
26 Jul 2024 04:57 PM
Hi guys,
Just to add to @AntonPineiro & @islam_zidan correct answers, you can always look for the ... at the top right
Click on API button
Which will help you to get the right API you need in this case for read
HTH
Yos
29 Jul 2024 08:16 AM
Thanks for your suggestion.
We are getting below error:
{ "error": { "code": 404, "message": "Settings not found" } }
29 Jul 2024 08:21 AM
Could you please share the Curl you used?
30 Jul 2024 09:19 AM
curl "https://{environmentid}.live.dynatrace.com/api/v2/settings/objects?schemaIds=builtin"%"3Amanagement-zones&scopes=environment&fields=objectId"%"2Cvalue" ^
-X GET ^
-H "Accept: application/json; charset=utf-8" ^
-H "Content-Type: application/json; charset=utf-8" ^
-H "Authorization: Api-Token xxxxxxx"
30 Jul 2024 10:05 AM
Hi @nicemukesh
For me in windows cmd the api request works OK
Also from Postman
From where are you running the curl command?
Yos
30 Jul 2024 09:18 AM
curl "https://{environmentid}.live.dynatrace.com/api/v2/settings/objects?schemaIds=builtin"%"3Amanagement-zones&scopes=environment&fields=objectId"%"2Cvalue" ^
-X GET ^
-H "Accept: application/json; charset=utf-8" ^
-H "Content-Type: application/json; charset=utf-8" ^
-H "Authorization: Api-Token XXXXXXXXXXXXX"
02 Aug 2024 03:50 PM
Hi All,
Thanks for all responses, i ran below CURL command, it is working now.
curl -X 'GET' \ 'https://{environmentid}.live.dynatrace.com/api/v2/settings/objects?schemaIds=builtin%3Amanagement-zones&fields=objectId%2Cvalue&pageSize=500' \ -H 'accept: application/json; charset=utf-8' \ -H 'Authorization: Api-Token XXXXXXXX'
I have a query, when i tried to run in Dynatrace API. Bit confused for object ID, how to fetch OBJECT ID.
Mukesh
05 Aug 2024 01:12 PM
Hi @nicemukesh
You need to fetch all the objects with get /settings/objects
The schema ID can be found on the MZ page
HTH
Yos
07 Aug 2024 04:09 PM
Thanks for your suggestions. it helps a lot