Writing custom plugin, how to determine proxy name from request URL?

I am writing a plugin that needs to access the resourcefiles of a proxy. To construct the URL to the resourcefiles the plugin needs to know the name of the proxy that is being hit. I could locally store a mapping of URL -> proxy name, but that doesn't scale well (i.e. we'd have to rebuild and deploy edgemicro everytime a proxy is added/changed).


I've inspected the request object and don't see any hints as to the proxy name. How do I determine this?

Solved Solved
0 6 1,006
1 ACCEPTED SOLUTION

One approach you could use to determine the proxy name is to use the management api to get the list of apis and traverse that list.


Here is the management api you could use :

http://docs.apigee.com/management/apis/get/organizations/%7Borg_name%7D/apis

Having said that it is generally not encouraged to use management apis from within the runtime.

Therefore I would suggest a separate proxy that runs the management apis to get the latest list of api proxies deployed. This list could be updated in a shared KVM.

Then use the custom code to retrieve the resource files from those apis in a separate api proxy by accessing the above shared KVM (environment level KVM)

http://docs.apigee.com/api-services/reference/key-value-map-operations-policy

This way - you would separate the api proxy that uses the management api and could choose to run it periodically - maybe once a week - depending on your development schedule.

View solution in original post

6 REPLIES 6

One approach you could use to determine the proxy name is to use the management api to get the list of apis and traverse that list.


Here is the management api you could use :

http://docs.apigee.com/management/apis/get/organizations/%7Borg_name%7D/apis

Having said that it is generally not encouraged to use management apis from within the runtime.

Therefore I would suggest a separate proxy that runs the management apis to get the latest list of api proxies deployed. This list could be updated in a shared KVM.

Then use the custom code to retrieve the resource files from those apis in a separate api proxy by accessing the above shared KVM (environment level KVM)

http://docs.apigee.com/api-services/reference/key-value-map-operations-policy

This way - you would separate the api proxy that uses the management api and could choose to run it periodically - maybe once a week - depending on your development schedule.

Not applicable

You have the best opportunity to learn the Plugins with the help of this site. This guideline is helpful for all beginners. I am Sheikha from UAE, working in a vast organization of Business Plan Writing Agency In Dubai. You can avail of my services regarding all of your company's business plans.

Not applicable
The topic is good. This subject is intended for developers who wish to expand the functionality of Edge Microgateway by writing custom plugins. I am assignment assistance and explore these kinds of topics to enhance my skills.

Not applicable

Sometimes I also face this issue it's not working when you enter proxy. Well, thanks for highlight this topic. My friend asks me to hire an online assignment for my programming task. They are highly experienced and know the art of creativity on any topic.

Not applicable

I don't use any plugin for this. I found one workaround for this.

I generated a custom report which has proxy name and base path. I do search in that excel and find the proxy name of the respective basepath

Not applicable

Thank you for the information. I wrote a term paper on this topic but could not get the section in order.