# List all incoming process connections using API

**URL:** <https://community.dynatrace.com/t/list-all-incoming-process-connections-using-api/47474>\
**Category:** Dynatrace API\
**Tags:** process-groups, hosts-classic, dynatrace-api\
**Created:** [September 4, 2024, 9:11am UTC](https://community.dynatrace.com/t/list-all-incoming-process-connections-using-api/47474 "2024-09-04T09:11:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![holst](https://avatars.discourse-cdn.com/v4/letter/h/9f8e36/32.png) [@holst](https://community.dynatrace.com/u/holst)\
**Post date:** [September 4, 2024, 9:11am UTC](https://community.dynatrace.com/t/list-all-incoming-process-connections-using-api/47474/1 "2024-09-04T09:11:14Z")

</div>

We have hundreds of Hosts, and among them like 50 running MS SQL database. Now we want to list all hosts/processes calling these MS SQL databases.

For a single host I can select the MS SQL process and use UI to see incoming processes.&nbsp; Now I want to do that for all servers, using API.&nbsp; I cant find anything how to do this in scale.&nbsp; We dont want to do it manually, becuase even if we spend a couple of hours doing it manually, we need an updated report next month.

Any ideas or suggestions?

NOTE, majority of Hosts only have Infrastructure mode agent.

---

<div class="post-metadata">

**Author:** ![axel\_tapia](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@axel\_tapia](https://community.dynatrace.com/u/axel_tapia)\
**Post date:** [September 10, 2024, 4:39pm UTC](https://community.dynatrace.com/t/list-all-incoming-process-connections-using-api/47474/2 "2024-09-10T16:39:21Z")

</div>

Not sure if this is what you are look for, I think you can get that by using entities API.

entitySelector&nbsp; query:

```auto
type(HOST),toRelationships.isProcessOf(type(PROCESS_GROUP_INSTANCE),toRelationships.isNetworkClientOf(type(PROCESS_GROUP_INSTANCE),softwareTechnologies(MICROSOFT_SQL_SERVER))

```

This will bring all host that have any PROCESS\_GROUP\_INSTANCE talking to any SQL Server PROCESS\_GROUP\_INSTANCES.

Curl example:

```auto
curl -X 'GET' \<br>'[dynatrace_url]/api/v2/entities?entitySelector=type(HOST),toRelationships.isProcessOf(type(PROCESS_GROUP_INSTANCE),toRelationships.isNetworkClientOf(type(PROCESS_GROUP_INSTANCE),softwareTechnologies(MICROSOFT_SQL_SERVER)))' \<br>-H 'accept: application/json; charset=utf-8' \<br>-H 'Authorization: Api-Token dt0c01.XXXXXXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'

```

Same query can be used in auto-tagging rule or management zone.

---

<div class="post-metadata">

**Author:** ![Peter\_Youssef](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/peter_youssef/32/14668_2.png) [@Peter\_Youssef](https://community.dynatrace.com/u/Peter_Youssef)\
**Post date:** [September 25, 2024, 8:19pm UTC](https://community.dynatrace.com/t/list-all-incoming-process-connections-using-api/47474/3 "2024-09-25T20:19:15Z")

</div>

Hi&nbsp;[@holst](https://community.dynatrace.com/user/12887)

Thanks for raising such concern.

- please note, that Topology & Smartscape - Process group is **no longer available under environment Api v1** and it’s accessible through **environment Api v2**.
- for which it will require creating an access token with “entities.read” scope.

 ![Peter_Youssef_0-1727293429651.png](https://global.discourse-cdn.com/dynatrace/original/3X/9/2/92ff60a1009431c50cc90856e724735a4d76d156.png)

- **Having admin privileges** \> go to environment Api v2 \> monitored entities \> unlock using the created token, otherwise you should have at least the right to create personal access token with “environment:roles:viewer” **otherwise** the Dynatrace admin will create the token and provide you with the target API to utilize constantly as long as the token will never expire.
- start specifying the below parameters to get the intended result.

 ![Peter_Youssef_1-1727294304180.png](https://global.discourse-cdn.com/dynatrace/original/2X/1/1855c36d03e72f9dbb9664c4fb4d8419ed52ad93.png)

 ![Peter_Youssef_2-1727294505202.png](https://global.discourse-cdn.com/dynatrace/original/3X/d/e/deccfc1b9cfe2ae988ab6b0d6b017540c4dfb577.png)

**for monthly result**

 ![Peter_Youssef_3-1727294576353.png](https://global.discourse-cdn.com/dynatrace/original/2X/9/99e6ebb62ee1e844baeb263eb3f0308f442ce700.png)

**for sorting**

 ![Peter_Youssef_4-1727294678644.png](https://global.discourse-cdn.com/dynatrace/original/3X/c/9/c97ef5019e169673f104f99036e2188c0a0e4709.png)

**Execute and the below result message “200” should appear and you will be able to download the Json file.**

 ![Peter_Youssef_5-1727294745636.png](https://global.discourse-cdn.com/dynatrace/original/3X/2/a/2a78fea80dc6466688ac76df79400a1cc2d2cdda.png)

**for the curl bash you should receive the curl command to call the api externally**

curl -X ‘GET’ \  
‘[https://abcdef/e/env\_id/api/v2/entities?pageSize=500&entitySelector=type(HOST)%2CtoRelationships.isProcessOf(type(PROCESS\_GROUP\_INSTANCE)%2CtoRelationships.isNetworkClientOf(type(PROCESS\_GROUP\_INSTANCE)%2CsoftwareTechnologies(MICROSOFT\_SQL\_SERVER))&from=now&to=-30d&sort=sort%3D%2Bname](https://abcdef/e/env_id/api/v2/entities?pageSize=500&entitySelector=type%28HOST%29%2CtoRelationships.isProcessOf%28type%28PROCESS_GROUP_INSTANCE%29%2CtoRelationships.isNetworkClientOf%28type%28PROCESS_GROUP_INSTANCE%29%2CsoftwareTechnologies%28MICROSOFT_SQL_SERVER%29%29&from=now&to=-30d&sort=sort%3D%2Bname)’ \  
-H ‘accept: application/json; charset=utf-8’

You can customize the entity selector as per actual requirements as described by&nbsp;[@axel\_tapia](https://community.dynatrace.com/user/53547)&nbsp;.

Regards,

Peter.
