# Again a surprise in Dynatrace, key requests

**URL:** <https://community.dynatrace.com/t/again-a-surprise-in-dynatrace-key-requests/34179>\
**Category:** Open Q&A\
**Tags:** services-classic, key-requests\
**Created:** [February 17, 2022, 2:14pm UTC](https://community.dynatrace.com/t/again-a-surprise-in-dynatrace-key-requests/34179 "2022-02-17T14:14:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![henk\_stobbe](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/henk_stobbe/32/30434_2.png) [@henk\_stobbe](https://community.dynatrace.com/u/henk_stobbe)\
**Post date:** [February 17, 2022, 2:14pm UTC](https://community.dynatrace.com/t/again-a-surprise-in-dynatrace-key-requests/34179/1 "2022-02-17T14:14:38Z")

</div>

Hello there is a new way to create and remove key requests in a service:

 ![henk_stobbe_1-1645107164506.png](https://global.discourse-cdn.com/dynatrace/original/3X/3/c/3ca6c6d71ac97bb3b3b2ea033d50d22c3f7a5573.png)

No more waiting for the request to show itself, thanks Dynatrace!

KR Henk

---

<div class="post-metadata">

**Author:** ![pahofmann](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pahofmann/32/17076_2.png) [@pahofmann](https://community.dynatrace.com/u/pahofmann)\
**Post date:** [February 17, 2022, 3:00pm UTC](https://community.dynatrace.com/t/again-a-surprise-in-dynatrace-key-requests/34179/2 "2022-02-17T15:00:43Z")

</div>

Great find, finally addresses&nbsp;[this Product Idea.](https://community.dynatrace.com/post/163416#M28315)

---

<div class="post-metadata">

**Author:** ![henridb](https://avatars.discourse-cdn.com/v4/letter/h/bc79bd/32.png) [@henridb](https://community.dynatrace.com/u/henridb)\
**Post date:** [February 18, 2022, 7:06am UTC](https://community.dynatrace.com/t/again-a-surprise-in-dynatrace-key-requests/34179/3 "2022-02-18T07:06:00Z")

</div>

Also the “Muted requests” just below that option is new&nbsp;:wink:

---

<div class="post-metadata">

**Author:** ![Karolina\_Linda](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/karolina_linda/32/36089_2.png) [@Karolina\_Linda](https://community.dynatrace.com/u/Karolina_Linda)\
**Post date:** [February 18, 2022, 8:11am UTC](https://community.dynatrace.com/t/again-a-surprise-in-dynatrace-key-requests/34179/4 "2022-02-18T08:11:52Z")

</div>

Thanks for sharing, Henk!

---

<div class="post-metadata">

**Author:** ![henridb](https://avatars.discourse-cdn.com/v4/letter/h/bc79bd/32.png) [@henridb](https://community.dynatrace.com/u/henridb)\
**Post date:** [February 28, 2022, 1:06pm UTC](https://community.dynatrace.com/t/again-a-surprise-in-dynatrace-key-requests/34179/5 "2022-02-28T13:06:30Z")

</div>

Only remark: The Key requests and Mute requests options are also visible for Database services but have no function there…

---

<div class="post-metadata">

**Author:** ![henk\_stobbe](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/henk_stobbe/32/30434_2.png) [@henk\_stobbe](https://community.dynatrace.com/u/henk_stobbe)\
**Post date:** [February 28, 2022, 1:15pm UTC](https://community.dynatrace.com/t/again-a-surprise-in-dynatrace-key-requests/34179/6 "2022-02-28T13:15:13Z")

</div>

Great find Henri!

---

<div class="post-metadata">

**Author:** ![adam\_gardner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/adam_gardner/32/20087_2.png) [@adam\_gardner](https://community.dynatrace.com/u/adam_gardner)\
**Post date:** [March 1, 2022, 4:59am UTC](https://community.dynatrace.com/t/again-a-surprise-in-dynatrace-key-requests/34179/7 "2022-03-01T04:59:51Z")

</div>

Just to round off this thread, there is an API available to do this way ahead of time too (as part of a pipeline?) I’ve wrapped it in a container.

1. Create a Dynatrace API token with v2 read entities and write settings permissions

2. Create a CSV using a pipe as a separator. Save as input.csv:

```auto
entitySelector|request_name
type(SERVICE),tag(app:frontend)|/pageOne.html
type(SERVICE),tag(app:frontend),tag(environment: production)|/pageTwo.html
type(SERVICE),tag(app:frontend)|/pageThree.html
type(SERVICE),tag(app:frontend)|/pageFour.html

```

2. From the **same directory** , run this:

```auto
docker run --rm ^
--mount type=bind,source=%cd%/input.csv,target=/app/input.csv ^
-e filename=input.csv ^
-e dt_url=https://{environmentid} ^
-e dt_api_token=dt0c01. ************* ^
adamgardnerdt/key-request-creator:0.0.2

```

For debugging add a new -e parameter dt\_logging=1:

```auto
docker run --rm ^
--mount type=bind,source=%cd%/input.csv,target=/app/input.csv ^
-e dt_logging=1 ^
-e filename=input.csv ^
-e dt_url=https://{environmentid} ^
-e dt_api_token=dt0c01. ************* ^
adamgardnerdt/key-request-creator:0.0.2

```

# What The Container Does

1. Mount the input.csv file into /app/input.csv inside the container.

2. For each entity selector, the script looks up the matching SERVICE IDs then creates Key requests against them.

# Known Limitations

1. The entity type (eg. SERVICE) must exist before you can create config against it. So as long as the SERVICE is there, the key request will be created (even if that endpoint has never had traffic) but no service = no key request. So it’s easy to ensure this. Onboard your service and send a few requests to /dummy (even if it 404s) and the service will be available within minutes.

---

<div class="post-metadata">

**Author:** ![MevlutS](https://avatars.discourse-cdn.com/v4/letter/m/ce73a5/32.png) [@MevlutS](https://community.dynatrace.com/u/MevlutS)\
**Post date:** [April 17, 2022, 5:03pm UTC](https://community.dynatrace.com/t/again-a-surprise-in-dynatrace-key-requests/34179/8 "2022-04-17T17:03:00Z")

</div>

Thank you&nbsp;[@adam\_gardner](https://community.dynatrace.com/user/167). It is really useful. We can develop our automation but there is not a any guide or example for this. Indeed, confusing a little bit.

Is it possible to share with us the guide or example for just key request api usage ?
