Is there anyway we can handle unknown resource at a single place instead of adding the code in every proxy? i.e if the requested base path or resource path doesn't exist then raise fault with an error message.
@Mahammad Feroz , Yes, You can do that flow hooks. Have you explored same ?
If you just looking to get rid of repetition everywhere.
https://community.apigee.com/articles/39071/using-shared-flows-for-common-error-handling.html
If you find yourself writing lot of conditions to check for 404 cases a handy way is to use a separate flow.
<Flow name="CatchAll"> <Request> <Step> <Name>FaultInvalidOperation</Name> <Condition>request.verb != "GET"</Condition> </Step> <Step> <Name>FaultInvalidResource</Name> </Step> </Request> <Response/> </Flow>
and yes usually 404s don't have anything interesting to write some logic in each bundle, but I find it more readable when I have to debug something.
@Madhan Sadasivam, the above approach works for handling an invalid resource paths with in an API proxy. But what about handling an invalid resource at an environment level? I mean if the requested resource path doesn't exist in any of the API proxies.
User | Count |
---|---|
7 | |
2 | |
2 | |
2 | |
1 |