21 Jun 2024 03:46 PM
I'm trying to create a set of web request naming rules, ideally for the enterprise, that will replace unique identifiers in the strings with something like "[identifier]". The identifier can be located in various "fields" within the path, everything from field 2 to field 9. In addition, there can be multiple identifiers in a single request. I can't afford to create a rule for every permutation of a pattern. I was hoping someone could help me with simplifying the rule so I don't have to "hard code" which field in the path that the capture groups is in (field 3 or field 4) instead of 2 rules. I was also looking if there is a way to easily replace all unique identifiers.
***The Generate clean URL would match how I would like but deletes the capture group vs replacing with a string***
***Maybe this is a use case for the OpenPipeline feature that isn't yet released but would love to hear about***
A couple simple examples of request names with the complexity:
/v1/api/12345/status
/v1/api/client/NE873HES
/v1/api/N78N6383/product/123457
I'm testing with some rules, but hoping to simplify the number of rules and completeness.
Matching rules are built to define which field in the path to match the regex (which is Capital letters || numbers || \ || _)
Rule 1 for the first example: This will find the pattern in 3rd field of path, delimiting by '/' character. The "pre-identifier3", captures everything before the pattern I want to replace. The "post-identifier3", captures everything after pattern to be replaced.
Matching condition: ^.[^\/]*+\/.[^\/]*+\/[A-Z0-9\-_]{2}
Place holder name: {pre-identifier3}[IDENTIFIER]{post-identifier3}
pre-identifier3: (.[^\/]*+\/.[^\/]*+\/)[A-Z0-9\-_]
post-identifier3: .[^\/]*+\/.[^\/]*+\/[A-Z0-9\-_]*+(/.*+)
Rule 2 for the second example: This will find the pattern in 4th field of path, delimiting by '/' character. The "pre-identifier4", captures everything before the pattern I want to replace. The "post-identifier4", captures everything after pattern to be replaced.
Matching condition: ^.[^\/]*+\/.[^\/]*+\/.[^\/]*+\/[A-Z0-9\-_]{2}
Place holder name: {pre-identifier4}[IDENTIFIER]{post-identifier4}
pre-identifier3: (.[^\/]*+\/.[^\/]*+\/.[^\/]*+\/)[A-Z0-9\-_]
post-identifier3: .[^\/]*+\/.[^\/]*+\/.[^\/]*+\/[A-Z0-9\-_]*+(/.*+)
For the 3rd example, it will be caught by Rule 1 and the second identifier in the path will not be replaced. I know I could create another version of rule 1 and place it before rule 1 but at that point the number of rules will become ridiculous for all the variations.
Solved! Go to Solution.
21 Jun 2024 08:56 PM
Have you seen PRO TIP - Global request naming for REST services ?