# Get Service Method and call numbers

**URL:** <https://community.dynatrace.com/t/get-service-method-and-call-numbers/31794>\
**Category:** Dynatrace API\
**Tags:** dynatrace-api\
**Created:** [June 14, 2021, 10:08am UTC](https://community.dynatrace.com/t/get-service-method-and-call-numbers/31794 "2021-06-14T10:08:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cespo](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@Cespo](https://community.dynatrace.com/u/Cespo)\
**Post date:** [June 14, 2021, 10:08am UTC](https://community.dynatrace.com/t/get-service-method-and-call-numbers/31794/1 "2021-06-14T10:08:03Z")

</div>

Hi all,

I’m new on Dynatrace API and I’m trying to get automatically the same information I see on UI.

In particular I’d like to get, for any service on a host, the list of service methods with the number of requests (the same information I can see in the screenshot below).

 ![Cespo_0-1623663810070.png](https://global.discourse-cdn.com/dynatrace/original/2X/9/97841b1a6fbcc3ff77ac1b0d4e6e36490f003d0f.png)

Using

```markup
/api/v1/entity/infrastructure/processes?host="Host-Id"

```

I’ve the list of services on host but I haven’t found an API to get the service method list.

With this info I think I can use the metric “com.dynatrace.builtin:servicemethod.responsetime” but without the service method entity id I’m stucked.

Could you help me?

Thanks a lot!

Cespo

---

<div class="post-metadata">

**Author:** ![trevor\_masseng1](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/trevor_masseng1/32/2442_2.png) [@trevor\_masseng1](https://community.dynatrace.com/u/trevor_masseng1)\
**Post date:** [June 14, 2021, 6:29pm UTC](https://community.dynatrace.com/t/get-service-method-and-call-numbers/31794/2 "2021-06-14T18:29:06Z")

</div>

Hi Cespo,

In order to pull response time data out of Dynatrace per request, you have to mark the requests that you want to pull as key requests.

Performance data for requests is aggregated at the service level and stored for that service in a manner that the Metrics API can query. Marking a request as a key request makes Dynatrace store performance data for just that request separately as well, so it can be viewed for a longer period of time and queried through the APIs.

Once you mark your request as a key request, you can use the below API to pull response time data:

> **[Metrics API - GET metric data points](https://docs.dynatrace.com/docs/dynatrace-api/environment-api/metric-v2/get-data-points)**
>
> Read data points of one or multiple metrics via Metrics v2 API.

The below endpoint should be what you are looking for:

```markup
/api/v2/metric/query?metricSelector=builtin:service.keyRequest.response.time

```

All of the available metrics for Key Requests are on this page:

> **[Built-in classic metrics](https://docs.dynatrace.com/docs/analyze-explore-automate/metrics-classic/built-in-metrics)**
>
> Explore the complete list of built-in Dynatrace metrics.

---

<div class="post-metadata">

**Author:** ![Cespo](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@Cespo](https://community.dynatrace.com/u/Cespo)\
**Post date:** [June 15, 2021, 6:47am UTC](https://community.dynatrace.com/t/get-service-method-and-call-numbers/31794/3 "2021-06-15T06:47:50Z")

</div>

Hi trevor\_masseng1,

thanks for your reply. I’ve understood I need to set response.time and&nbsp;count.total as key requests before do any query.

But, if key requests are&nbsp;aggregated at the service level I’ve to set key requests for any service on any server?

In my case I’ve 5 servers and each server host about 300 services (with an average of 30 service methods each). I’ve to set key requests on any service of any server?

Thanks for your time

Cespo

---

<div class="post-metadata">

**Author:** ![trevor\_masseng1](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/trevor_masseng1/32/2442_2.png) [@trevor\_masseng1](https://community.dynatrace.com/u/trevor_masseng1)\
**Post date:** [June 15, 2021, 7:05am UTC](https://community.dynatrace.com/t/get-service-method-and-call-numbers/31794/4 "2021-06-15T07:05:35Z")

</div>

So response.time and count.total are metrics. What you want is to set SearchCustomer as a key request, then the SearchCustomer request will be given its own performance metrics aside from the service.  
If all of the services are named the same and belong to the same process group, then changing Search Customer to a key request for one service should change them for all hosts.

Otherwise, you’ll have to do this for each request and service pairing you want to pull data for.

---

<div class="post-metadata">

**Author:** ![Cespo](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@Cespo](https://community.dynatrace.com/u/Cespo)\
**Post date:** [June 15, 2021, 7:20am UTC](https://community.dynatrace.com/t/get-service-method-and-call-numbers/31794/5 "2021-06-15T07:20:49Z")

</div>

Hi&nbsp;trevor\_masseng1,

now it’s clear.&nbsp;Some services have the same name on different hosts and others do not.  
I understood that I have to list the services and retrieve all the unique names and for each of them set Search Customer as a key request.

Thanks for all your help!  
Cespo
