cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add request attribute as placeholder in URL Path

cameronduff
Participant

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: mydomain/subDomain/paymentAmount/15612

URL 3: mydomain/subDomain/paymentAmount/18912

Where the final values (12345, 15612 and 18912) are already being picked up as a request attribute via 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,

Cameron

4 REPLIES 4

Julius_Loman
DynaMight Guru
DynaMight Guru

You need to use request 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).

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

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

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.

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

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

This: mydomain/subDomain/paymentAmount/12345/somethingElse

To this: 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?