简体   繁体   中英

How to restrict APIGEE proxy to certain resources

I have Restful API with 40 endpoints like:

GET /user/:id GET /users POST /users

and etc....

I want to proxy API by Apigee but only certain endpoints, for example only one:

GET /users

Can't find the way how to do it.

When I add proxy it maps to all routes.

Assuming your Target API is at http://hostname/basepath/ Assuming that GET /users is equivalent to GET http://hostname/basepath/users and so on.. You'll need to create a API proxy with the Target URL: http://hostname/basepath Then, inside the API proxy, you need to create a resource for each valid (permitted) verb + resource path. For example, If GET /users and GET /users/:id is permitted, you need to create 2 resources in your API proxy: GET /users GET /users/* This can be done from the UI at the Overview section in the API proxy.

Once you finished defining the allowed resources, you need to add a Conditional Flow with NO Condition, that only responds with an Error (you can use a Raise Fault Policy). This can be done in the Develop section in the API proxy. This Conditional Flow, MUST be at the end, so if the request does not match any of the resources, it will match this default Conditional Flow, and it will trigger your Raise Fault policy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM