09 Jan 2023 04:40 PM - last edited on 12 May 2023 06:45 PM by AgataWlodarczyk
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 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, Cameron
Solved! Go to Solution.
09 Jan 2023 04:44 PM
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).
09 Jan 2023 04:48 PM
I see! So can I reuse the regex from my request attributes when making the POST API call for the new global naming rule?
09 Jan 2023 05:24 PM
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.
10 Jan 2023 10:04 AM
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?
09 Feb 2023 09:04 PM
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 - how to replace numbers in URLs (your use case, exactly) on a global level and configurable by tags.
12 May 2023 06:47 PM
@cameronduff did you find the answer to your question? If yes, please share.
If not, maybe @Julius_Loman still can help to find a final solution. 🙂