# Dynatrace V2 API - Metrics Call Does Not Return An Actual Server Name

**URL:** <https://community.dynatrace.com/t/dynatrace-v2-api-metrics-call-does-not-return-an-actual-server-name/31035>\
**Category:** Open Q&A\
**Tags:** dynatrace-saas\
**Created:** [April 6, 2021, 1:54pm UTC](https://community.dynatrace.com/t/dynatrace-v2-api-metrics-call-does-not-return-an-actual-server-name/31035 "2021-04-06T13:54:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![louis\_gallo](https://avatars.discourse-cdn.com/v4/letter/l/6f9a4e/32.png) [@louis\_gallo](https://community.dynatrace.com/u/louis_gallo)\
**Post date:** [April 6, 2021, 1:54pm UTC](https://community.dynatrace.com/t/dynatrace-v2-api-metrics-call-does-not-return-an-actual-server-name/31035/1 "2021-04-06T13:54:00Z")

</div>

In the Dynatrace V2 API, my query returns the data however it gives me the cryptic host-Id.

API call - https://\*\*\*\*\*\*.live.dynatrace.com/api/v2/metrics/query?metricSelector=builtin:host.cpu.(system)&resolution=1m&from=now-1h&to=now&entitySelector=type(HOST),tag(MyApplication:AppName)

I get this back (CSV Format):

metricId,dt.entity.host,time,value  
builtin:host.cpu.system,HOST-FFFFFFCFD79DB1E0,4/6/2021 12:45,0.778690974

How can I get the actual server name back rather than dt.entity.host?

Any help is appreciated.

Thanks,

Lou

---

<div class="post-metadata">

**Author:** ![JamesKitson](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/jameskitson/32/22460_2.png) [@JamesKitson](https://community.dynatrace.com/u/JamesKitson)\
**Post date:** [April 6, 2021, 3:13pm UTC](https://community.dynatrace.com/t/dynatrace-v2-api-metrics-call-does-not-return-an-actual-server-name/31035/2 "2021-04-06T15:13:42Z")

</div>

You need to use the ‘:names’ transformation described here:

> **[Metrics API - Metric selector](https://docs.dynatrace.com/docs/dynatrace-api/environment-api/metric-v2/metric-selector)**
>
> Configure the metric selector for the Metric v2 API.

---

<div class="post-metadata">

**Author:** ![louis\_gallo](https://avatars.discourse-cdn.com/v4/letter/l/6f9a4e/32.png) [@louis\_gallo](https://community.dynatrace.com/u/louis_gallo)\
**Post date:** [April 6, 2021, 4:56pm UTC](https://community.dynatrace.com/t/dynatrace-v2-api-metrics-call-does-not-return-an-actual-server-name/31035/3 "2021-04-06T16:56:27Z")

</div>

James, how would you modify this line?

[https://xxxxxxxx.live.dynatrace.com/api/v2/metrics/query?metricSelector=builtin:host.cpu.(system)&resolution=1m&from=now-1h&to=now&entitySelector=type(HOST),tag(MyApplication:MyApp)](https://xxxxxxxx.live.dynatrace.com/api/v2/metrics/query?metricSelector=builtin:host.cpu.(system)&resolution=1m&from=now-1h&to=now&entitySelector=type(HOST),tag(MyApplication:MyApp))

---

<div class="post-metadata">

**Author:** ![louis\_gallo](https://avatars.discourse-cdn.com/v4/letter/l/6f9a4e/32.png) [@louis\_gallo](https://community.dynatrace.com/u/louis_gallo)\
**Post date:** [April 6, 2021, 5:07pm UTC](https://community.dynatrace.com/t/dynatrace-v2-api-metrics-call-does-not-return-an-actual-server-name/31035/4 "2021-04-06T17:07:58Z")

</div>

oooo, wait, I think I got it. Does this look right??

builtin:host.cpu.(system):names:merge(1)

---

<div class="post-metadata">

**Author:** ![Yann\_Buccellato](https://avatars.discourse-cdn.com/v4/letter/y/97f17d/32.png) [@Yann\_Buccellato](https://community.dynatrace.com/u/Yann_Buccellato)\
**Post date:** [April 6, 2021, 6:49pm UTC](https://community.dynatrace.com/t/dynatrace-v2-api-metrics-call-does-not-return-an-actual-server-name/31035/5 "2021-04-06T18:49:14Z")

</div>

[@louis\_gallo](https://community.dynatrace.com/user/34149) that is right! You just don’t need the parentesis if you only want “system”:

builtin:host.cpu.system:names:merge

You would put parenthesis if you want another value regarding the cpu:

builtin:host.cpu.(system,usage):names:merge

v2 are tricky but really cool, once you wrap your mind around it!

---

<div class="post-metadata">

**Author:** ![louis\_gallo](https://avatars.discourse-cdn.com/v4/letter/l/6f9a4e/32.png) [@louis\_gallo](https://community.dynatrace.com/u/louis_gallo)\
**Post date:** [April 6, 2021, 7:54pm UTC](https://community.dynatrace.com/t/dynatrace-v2-api-metrics-call-does-not-return-an-actual-server-name/31035/6 "2021-04-06T19:54:12Z")

</div>

Thanks to all for helping me to get my feet wet. I’ll be working on app stats next through the V2 API. Fun fun fun and more questions.
