Hi All,
I have a query parameter that I want to apply some conditional logic to based on the value of the query parameter.
I have looked around in the documentation (https://docs.apigee.com/api-platform/fundamentals/flow-variables-and-conditions), but I am not seeing an obvious way to do what I want to do.
For example, if I have a query parameter called "StoreId" and based on the value of that store id I wanted to do different things.
<Step> <Condition>(request.verb = "POST") and (request.queryparams.StoreId = 1)</Condition> <Name>AssignSKUPrefix</Name> </Step>
I am about 99% sure that my request.queryparams is wrong, but I am not sure how to go about fixing it to work the way I want it to.
Any ideas?
Thanks.
Solved! Go to Solution.
Yes, you can do it that way. With a Condition element in your proxyendpoint or targetendpoint. (Actually within a FLOW within the endpoint).
You can also write some custom JavaScript, which runs for every step, and in that way codify the conditional logic in a traditional programming language.
var storeId = context.getVariable('request.queryparam.StoreId'); if (storeId == '1') { ... } else { ... }
And of course the Flow configuration would omit the Condition. It would look like this:
<Step> <Name>JS-HandleStoreIdQueryParam</Name> </Step>