# API to list Service Methods of a given Service

**URL:** <https://community.dynatrace.com/t/api-to-list-service-methods-of-a-given-service/34446>\
**Category:** Dynatrace API\
**Tags:** services-classic, dynatrace-api\
**Created:** [March 10, 2022, 6:11pm UTC](https://community.dynatrace.com/t/api-to-list-service-methods-of-a-given-service/34446 "2022-03-10T18:11:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shreyas\_shivapr](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@shreyas\_shivapr](https://community.dynatrace.com/u/shreyas_shivapr)\
**Post date:** [March 10, 2022, 6:11pm UTC](https://community.dynatrace.com/t/api-to-list-service-methods-of-a-given-service/34446/1 "2022-03-10T18:11:40Z")

</div>

I’m trying to list Service Methods (entityId and name) of a given Service ID using API. I tried v2/entities API but it lists the Service Method Group ID and not Service Methods. Looking for assistance on this.&nbsp;  
Example:

```auto
/api/v2/entities?entitySelector=entityId%28%22SERVICE- **** %22%29&fields=fromRelationships%2C%20toRelationships

```

---

<div class="post-metadata">

**Author:** ![mark\_bley](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mark_bley/32/20954_2.png) [@mark\_bley](https://community.dynatrace.com/u/mark_bley)\
**Post date:** [April 1, 2022, 10:47am UTC](https://community.dynatrace.com/t/api-to-list-service-methods-of-a-given-service/34446/2 "2022-04-01T10:47:57Z")

</div>

Hi&nbsp;[@shreyas\_shivapr](https://community.dynatrace.com/user/31766)&nbsp;,

that should be possible with e.g. following selector using Service ID

```markup
type(service_method),fromRelationships.isServiceMethodOf(type(service_method_group),fromRelationships.isGroupOf(type(service),entityId("SERVICE-008E1A2A04B8303E")))

```

Best,

Mark

---

<div class="post-metadata">

**Author:** ![Harsh](https://avatars.discourse-cdn.com/v4/letter/h/57b2e6/32.png) [@Harsh](https://community.dynatrace.com/u/Harsh)\
**Post date:** [April 25, 2022, 8:27am UTC](https://community.dynatrace.com/t/api-to-list-service-methods-of-a-given-service/34446/3 "2022-04-25T08:27:30Z")

</div>

Hi&nbsp;&nbsp;[mark\_bley](https://community.dynatrace.com/user/13072)  
I tried the same approach but for me the results were coming to be empty, can you help here. I replaced the enitityId wrt my application&nbsp;  
type(service\_method),fromRelationships.isServiceMethodOf(type(service\_method\_group),fromRelationships.isGroupOf(type(service),entityId(“SERVICE-E497A5840A6A5468”)))

---

<div class="post-metadata">

**Author:** ![mark\_bley](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mark_bley/32/20954_2.png) [@mark\_bley](https://community.dynatrace.com/u/mark_bley)\
**Post date:** [April 25, 2022, 1:05pm UTC](https://community.dynatrace.com/t/api-to-list-service-methods-of-a-given-service/34446/4 "2022-04-25T13:05:04Z")

</div>

Hi&nbsp;[@Harsh](https://community.dynatrace.com/user/50317),

please try the query bit by bit, i.e. starting with

```markup
type(service),entityId("SERVICE-008E1A2A04B8303E")

```

and then

```auto
type(service_method_group),fromRelationships.isGroupOf(type(service),entityId("SERVICE-008E1A2A04B8303E"))

```

and check when you are not getting any more results.

---

<div class="post-metadata">

**Author:** ![Harsh](https://avatars.discourse-cdn.com/v4/letter/h/57b2e6/32.png) [@Harsh](https://community.dynatrace.com/u/Harsh)\
**Post date:** [April 26, 2022, 10:23am UTC](https://community.dynatrace.com/t/api-to-list-service-methods-of-a-given-service/34446/5 "2022-04-26T10:23:40Z")

</div>

Tried the above approach but still now able to get the results. can you suggest the right metric selector that would help  
type(SERVICE\_METHOD),fromRelationships.isServiceMethodOf(type(service\_method\_group)  
till the above selector i am able to see all service\_methods , how can we sort further using the EnitiyID - if i add that then result comes to be empty
