How to match path variables in the URI path with proxy.pathsuffix MatchesPath

Not applicable

Hi

I want to have a flow in which I want to have a condition of matching path

I have the path as

v1/customers/mobile_number:9818526830/recipients?initiator_id=mobile_number:9910028267

In the path the mobile_number:9818526830 are variables and can change, now how can I match this using

proxy.pathsuffix MatchesPath "/v1/customers/{id_type}:{id}/recipients. As you can see I tried giving these two as varibales but now it is now allowing me to save. Can someone please help how to solve this.

Regards

Nirmal

0 2 4,044
2 REPLIES 2

adas
Participant V

@Nirmal Maheshwari Apigee conditions supports regular expressions JavaRegex, so you could use a regular expression instead of a variable.

In your case you could use something like this:

<Condition>proxy.pathsuffix MatchesPath "/customers/**/recipients"</Condition>

Not applicable

I recommend using Raise Fault policy on {id_type} and {id} if you expect a specific variable. Extract them first then you can set the condition at Raise Fault policy.

on the {id_type} you can set condition as:

<Condition>id_type != "mobile_number"</Condition>

and just have a check if the format is right at:

<Condition>id JavaRegex "(insert your regex here)"></Condition>