Condition for Apigee get api query params

Hi ,

Url : /param 1/ ?param2= {dynamic value} & param3 = {dynamic value}

I need to allow the url, only if it is in the above format, how can I write a condition for the above url, tried below is not working.

((proxy.pathsuffix MatchesPath "/param 1/ ?param2= * & param3 = * ") AND (request.verb = “GET”))

Thanks

I think the order of param2 and param3 is probably not important , right? According to the HTTP spec, semantically it does not matter if query param2 appears before param3 in the query string. So what I would do is :

<Condition>request.verb = "GET" AND 
     proxy.pathsuffix ~~ "/param1/?" AND 
     request.queryparam.param2 != null AND
     request.queryparam.param3 != null 
     </Condition>

You may have to collapse that to “all one line” in order to get it to work properly. I broke it into multiple lines just for readability.

The ~~ in there is a regex match. That matches when the pathsuffix is /param1 or /param1/. (without or with the trailing slash)

The rest of those clauses should be pretty self explanatory.

2 Likes

Thanks @dchiesa1 ,need a condition which has to allow only /param 1/ ? ... not /param 1 or

/param 1/