# Running Managed API for python script issue

**URL:** <https://community.dynatrace.com/t/running-managed-api-for-python-script-issue/50861>\
**Category:** Dynatrace Managed\
**Tags:** dynatrace-managed, python, dynatrace-api\
**Created:** [March 24, 2025, 7:02pm UTC](https://community.dynatrace.com/t/running-managed-api-for-python-script-issue/50861 "2025-03-24T19:02:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![carloss](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@carloss](https://community.dynatrace.com/u/carloss)\
**Post date:** [March 24, 2025, 7:02pm UTC](https://community.dynatrace.com/t/running-managed-api-for-python-script-issue/50861/1 "2025-03-24T19:02:36Z")

</div>

I am having trouble running the Managed API for my python script. The url I see on my managed account is [https://dynatrace/e/xxx-xxx-xxx/api/v2/metrics](https://dynatrace/e/xxx-xxx-xxx/api/v2/metrics)  
but the URL output on the doc is https://{your-domain}/e/{your-environment-id}/api/v2/metrics /// shows my domain as dynatrace/e/  
[Metrics API - GET metrics — Dynatrace Managed Docs](https://docs.dynatrace.com/managed/discover-dynatrace/references/dynatrace-api/environment-api/metric-v2/get-all-metrics)

---

<div class="post-metadata">

**Author:** ![patryk\_ozimek2](https://avatars.discourse-cdn.com/v4/letter/p/bbce88/32.png) [@patryk\_ozimek2](https://community.dynatrace.com/u/patryk_ozimek2)\
**Post date:** [March 24, 2025, 8:27pm UTC](https://community.dynatrace.com/t/running-managed-api-for-python-script-issue/50861/2 "2025-03-24T20:27:41Z")

</div>

Hi

What exactly are you having trouble with? Could you please explain it a little bit further? If you can please provide the request and response that you received.

Best Regards

Patryk

---

<div class="post-metadata">

**Author:** ![KeeganNelson](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/keegannelson/32/20333_2.png) [@KeeganNelson](https://community.dynatrace.com/u/KeeganNelson)\
**Post date:** [March 24, 2025, 8:45pm UTC](https://community.dynatrace.com/t/running-managed-api-for-python-script-issue/50861/3 "2025-03-24T20:45:35Z")

</div>

You should see something like this in your environment URL when accessing the Dynatrace platform.&nbsp;  
[https://3423sdf2-sd2f-4343-34d3-343](https://3423sdf2-sd2f-4343-34d3-343) **e** [3433d3430-1.managed.internal.dynatrace.com](http://3433d3430-1.managed.internal.dynatrace.com)&nbsp;  
https://\<Domain\> **e** \<your-evironment-id\>

The next step would be placing your domain and environment id into the API endpoint.

Hopefully this helps!

---

<div class="post-metadata">

**Author:** ![carloss](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@carloss](https://community.dynatrace.com/u/carloss)\
**Post date:** [March 24, 2025, 8:48pm UTC](https://community.dynatrace.com/t/running-managed-api-for-python-script-issue/50861/4 "2025-03-24T20:48:36Z")

</div>

I see this url when I log into my Managed ’

[https://dynatrace/e/0728af0e-825c-490b-b586-xxx](https://dynatrace/e/0728af0e-825c-490b-b586-xxx)’;&nbsp;&nbsp;what confusing to me is the doc says I should see

https://{your-domain}/e/{your-environment-id}&nbsp;&nbsp;to run the api

---

<div class="post-metadata">

**Author:** ![carloss](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@carloss](https://community.dynatrace.com/u/carloss)\
**Post date:** [March 24, 2025, 8:50pm UTC](https://community.dynatrace.com/t/running-managed-api-for-python-script-issue/50861/5 "2025-03-24T20:50:14Z")

</div>

I see this url when I log into my Managed ’

[https://dynatrace/e/0728af0e-825c-490b-b586-xxx](https://dynatrace/e/0728af0e-825c-490b-b586-xxx)’;&nbsp;&nbsp;what confusing to me is the doc says I should see

https://{your-domain}/e/{your-environment-id}&nbsp;&nbsp;to run the api I have not ran my script yet because my url just says dynatrace/e is that my domain? or what does {your-domain} refer too

---

<div class="post-metadata">

**Author:** ![patryk\_ozimek2](https://avatars.discourse-cdn.com/v4/letter/p/bbce88/32.png) [@patryk\_ozimek2](https://community.dynatrace.com/u/patryk_ozimek2)\
**Post date:** [March 24, 2025, 8:59pm UTC](https://community.dynatrace.com/t/running-managed-api-for-python-script-issue/50861/6 "2025-03-24T20:59:32Z")

</div>

Hi

You should use the same URL that you see in the browser.

Let me know if it works after running the script.

Best Regards  
Patryk

---

<div class="post-metadata">

**Author:** ![lubrman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/lubrman/32/7353_2.png) [@lubrman](https://community.dynatrace.com/u/lubrman)\
**Post date:** [March 25, 2025, 6:31am UTC](https://community.dynatrace.com/t/running-managed-api-for-python-script-issue/50861/7 "2025-03-25T06:31:09Z")

</div>

And what is the purpose of the script supposed to be?

Anyway, the doc provides the information correctly — you just need to replace the values your domain and env ID with the ones you see in your browser when you log into the environment.
