Original Message:
Sent: Wed March 01, 2023 09:50 AM
From: Steve Linn
Subject: switch policy with custom condition in native gateway
Hi Rajesh,
v5 and v5 compatible use GatewayScript in the conditionals, whereas the API Gateway uses JSONata. You'd simply use
login = true
where login is your variable. You don't need to specify code to get the variable, just the variable name is assumed to need to be pulled from the context.
Regards,
Steve
------------------------------
Steve Linn
Senior Consulting I/T Specialist
IBM
Original Message:
Sent: Tue February 28, 2023 10:26 AM
From: Rajesh Solanki
Subject: switch policy with custom condition in native gateway
We are migrating one of our API from v5 compatible gateway to api gateway.
in my v5 compatible API i have set a variable as Boolean and i m setting value using apim.setvariable
in v5 compatible switch has if condition like apim.getvaribale('login') == true
in my new API i have set a variable as Boolean and i m setting value using context.set
in api gateway switch policy i wrote (if context.get('login') = true) but validation failed.
so how do i write a custom condition which reads local variable ?
------------------------------
Rajesh Solanki
------------------------------