Hello all,
I have an api proxy. I am using service call out policy to get one Boolean value from another target. and Using Extract variable policy to assign the value. added in Proxy end point Pre flow
Based on value I need to call my target url. if value is false i dont want to hit my target url. with out hitting target is should return error to the client.
I m setting my target url in JavaScript and added into target endpoint pre flow. if value is true than hit JavaScript policy should run.
context.setVariable("target.url","http://*****************");
if value is false from their only revert back to the client.
Please help.
Solved! Go to Solution.
@Madhav , As per my understanding, your requirement is as below:
If my understanding is correct then you can implement as follows:
You can use raisefault policy to throw required error response back to client if you don't get required value from service callout. This will move the API proxy processing to fault rules section and will not call any target endpoint there after. Try that way and see if it works.
Thanks,
Santosh
@Madhav , As per my understanding, your requirement is as below:
If my understanding is correct then you can implement as follows:
@Mahammad Feroz how would you do step 3 in the implementation?
Raise fault is a policy which can be added to any flow with one or more cnditions.
https://docs.apigee.com/api-platform/reference/policies/raise-fault-policy#top_of_page
Thanks santosh