# Which API?:  kubernetes \> get list of project ID, project name, namespace, PODs

**URL:** <https://community.dynatrace.com/t/which-api-kubernetes-get-list-of-project-id-project-name-namespace-pods/37277>\
**Category:** Dynatrace API\
**Tags:** dynatrace-api\
**Created:** [November 14, 2022, 8:09pm UTC](https://community.dynatrace.com/t/which-api-kubernetes-get-list-of-project-id-project-name-namespace-pods/37277 "2022-11-14T20:09:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![avrildong](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@avrildong](https://community.dynatrace.com/u/avrildong)\
**Post date:** [November 14, 2022, 8:09pm UTC](https://community.dynatrace.com/t/which-api-kubernetes-get-list-of-project-id-project-name-namespace-pods/37277/1 "2022-11-14T20:09:07Z")

</div>

Use case & Goal:

Applicable to both “GCP \> GKE” and “Openshift”. We intend to retrieve list of&nbsp;project ID (gce project id if apply), project name(gce project name if apply), namespace, PODs, cluster name, process group name ( if present).

Question: which API we can use to grab above?&nbsp; namespace is must-have info.

---

<div class="post-metadata">

**Author:** ![mizso74](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mizso74/32/41729_2.png) [@mizso74](https://community.dynatrace.com/u/mizso74)\
**Post date:** [November 15, 2022, 9:53am UTC](https://community.dynatrace.com/t/which-api-kubernetes-get-list-of-project-id-project-name-namespace-pods/37277/2 "2022-11-15T09:53:50Z")

</div>

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

Maybe there is a more simple way but I would use the from the Enviroment Api v2 Monitored entities set.

I have just created a auto tag for Kubernetes entities.

 ![Mizs_0-1668505447378.png](https://global.discourse-cdn.com/dynatrace/original/3X/4/0/400d8c9026a906f91de2da4583ea4dd199324022.png)

Then I have used thre Get / entities Api with with the Entity Selector Type(“Process\_Group\_Instance”),Tag(“Kubernetes”). So I have already received the a list of kubernetes process group list.

 ![Mizs_2-1668505691137.png](https://global.discourse-cdn.com/dynatrace/original/2X/5/5647d17ecd0e880a2112480103b9e0615da173d8.png)

From the list I have picked up a process group instance and checked it with the following Api call: GET / entities/({entityId}:

 ![Mizs_3-1668505845558.png](https://global.discourse-cdn.com/dynatrace/original/2X/2/2aff6224db816691a43a827f6a2714d243a4292a.png)

I have already received the properties:

 ![Mizs_4-1668505963722.png](https://global.discourse-cdn.com/dynatrace/original/2X/8/81f5b81eaf0332bc1b9f39304122b761f1114b70.png)

Try and play with these Monitored entities API calls.

I hope it helps.

Best regards,

Mizső

---

<div class="post-metadata">

**Author:** ![avrildong](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@avrildong](https://community.dynatrace.com/u/avrildong)\
**Post date:** [November 18, 2022, 11:55pm UTC](https://community.dynatrace.com/t/which-api-kubernetes-get-list-of-project-id-project-name-namespace-pods/37277/3 "2022-11-18T23:55:31Z")

</div>

[@Mizső](https://community.dynatrace.com/user/47783)

Thanks for your approach! It works.

FYI one more approach I just got from other parties and it works too, similar principle as yours using same identifier “kubernetesNamespaces”.

api/v1/entity/infrastructure/processes \> identify via “kubernetesNamespaces” , no need to custom tag (save one step), just straight use that.

So as of now 2 API - either:

- api/v2/entities?entitySelector=Type(“Process\_Group\_Instance”)&fields=firstSeenTms,lastSeenTms,properties,tags,managementZones , then filter by “properties”.“metadata”.“key” start with “KUBERNETES\_%”
- api/v1/entity/infrastructure/processes
