# Add request attribute as a placeholder in the URL path

**URL:** <https://community.dynatrace.com/t/add-request-attribute-as-a-placeholder-in-the-url-path/37928>\
**Category:** Alerting\
**Tags:** services-classic, request-attributes\
**Created:** [January 9, 2023, 4:40pm UTC](https://community.dynatrace.com/t/add-request-attribute-as-a-placeholder-in-the-url-path/37928 "2023-01-09T16:40:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cameronduff](https://avatars.discourse-cdn.com/v4/letter/c/2bfe46/32.png) [@cameronduff](https://community.dynatrace.com/u/cameronduff)\
**Post date:** [January 9, 2023, 4:40pm UTC](https://community.dynatrace.com/t/add-request-attribute-as-a-placeholder-in-the-url-path/37928/1 "2023-01-09T16:40:48Z")

</div>

Hi all,

I am trying to create a global placeholder for a request attribute I have set up. For example:

URL 1: mydomain/subDomain/paymentAmount/12345

URL 2:&nbsp;mydomain/subDomain/paymentAmount/15612

URL 3:&nbsp;mydomain/subDomain/paymentAmount/18912

Where the final values (12345,&nbsp;15612 and&nbsp;18912) are already being picked up as a request attribute via the regex I have set up. Is there any way to group these requests using the request attribute as a placeholder for the amount for example:

mydomain/subDomain/paymentAmount/{amount}

Thanks,&nbsp;Cameron

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [January 9, 2023, 4:44pm UTC](https://community.dynatrace.com/t/add-request-attribute-as-a-placeholder-in-the-url-path/37928/2 "2023-01-09T16:44:31Z")

</div>

You need to use [request naming rules](https://www.dynatrace.com/support/help/shortlink/request-attributes-naming-rules) for the service or set of services. It’s independent of request attributes. You can use request attributes in the request naming rules when you need the value to be part of the request name (you want the opposite).

---

<div class="post-metadata">

**Author:** ![cameronduff](https://avatars.discourse-cdn.com/v4/letter/c/2bfe46/32.png) [@cameronduff](https://community.dynatrace.com/u/cameronduff)\
**Post date:** [January 9, 2023, 4:48pm UTC](https://community.dynatrace.com/t/add-request-attribute-as-a-placeholder-in-the-url-path/37928/3 "2023-01-09T16:48:33Z")

</div>

I see! So can I reuse the regex from my request attributes when making the POST API call for the new global naming rule?

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [January 9, 2023, 5:24pm UTC](https://community.dynatrace.com/t/add-request-attribute-as-a-placeholder-in-the-url-path/37928/4 "2023-01-09T17:24:36Z")

</div>

Yes, exactly. But don’t use regex unless necessary. Briefly looking at your sample URLs a simple rule just for URL path starting with a certain string could do what you need. If you need to check if there is the parameter and it has a numeric value, then I’d use regex.

---

<div class="post-metadata">

**Author:** ![cameronduff](https://avatars.discourse-cdn.com/v4/letter/c/2bfe46/32.png) [@cameronduff](https://community.dynatrace.com/u/cameronduff)\
**Post date:** [January 10, 2023, 10:04am UTC](https://community.dynatrace.com/t/add-request-attribute-as-a-placeholder-in-the-url-path/37928/5 "2023-01-10T10:04:31Z")

</div>

Perfect! Thank you 🙂 If I wanted to replace a parameter in the middle of a URL Path e.g:

This:&nbsp;mydomain/subDomain/paymentAmount/12345/somethingElse

To this:&nbsp;mydomain/subDomain/paymentAmount/{amount}/somethingElse

How would this be achieved in the naming pattern? As you need to add the placeholder in the naming pattern?

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [February 9, 2023, 9:04pm UTC](https://community.dynatrace.com/t/add-request-attribute-as-a-placeholder-in-the-url-path/37928/6 "2023-02-09T21:04:06Z")

</div>

Yes, you need a placeholder for that, definitely. You need to extract the postfix and the prefix using placeholders and only when it matches.

Please, have a look at [another solution](https://community.dynatrace.com/post/176341#M289)&nbsp;- how to replace numbers in URLs (your use case, exactly) on a global level and configurable by tags.

---

<div class="post-metadata">

**Author:** ![agata.wlodarczyk](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/agata.wlodarczyk/32/22_2.png) [@agata.wlodarczyk](https://community.dynatrace.com/u/agata.wlodarczyk)\
**Post date:** [May 12, 2023, 5:47pm UTC](https://community.dynatrace.com/t/add-request-attribute-as-a-placeholder-in-the-url-path/37928/7 "2023-05-12T17:47:45Z")

</div>

[@cameronduff](https://community.dynatrace.com/user/57062)&nbsp;did you find the answer to your question? If yes, please share.&nbsp;  
If not, maybe&nbsp;[@Julius\_Loman](https://community.dynatrace.com/user/3364)&nbsp;still can help to find a final solution. 🙂
