I am trying to write a client in Angular that will automagically populate a file with the ReST URLs of the all the api proxies in a given organization. I did get around to find some API's that gave a list of all the proxies in an organization and another API that gave out the proxy details sans the ReST URL!
I am looking around to find an API or combination(not preferred) thereof which would give out this ReST URL
@Vidya Sathyamurthy Unfortunately there's no single API that you can consume to construct the REST endpoint of your proxy. I think it would be a good addition to our list of management APIs, so let me open a feature request for it.
In the meantime, here's what you can do:
Get list of environments: curl -v https://api.enterprise.apigee.com/v1/o/{org}/e Get list of virtualhosts: curl -v https://api.enterprise.apigee.com/v1/o/{org}/e/{env}/virtualhosts **Get virtualhost info: curl -v https://api.enterprise.apigee.com/v1/o/{org}/e/{env}/virtualhosts/{vh}
From the above list of apis, you can fetch all the environments in your org, you can get all the virtualhosts in that environment and get the virtualhost details for a given vh for an environment. A sample output from the /virtualhosts/{vh} management API is given below:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <VirtualHost name="default"> <HostAliases> <HostAlias>myorg-test.apigee.net</HostAlias> </HostAliases> <Interfaces/> <Port>80</Port> </VirtualHost>
You can use the Alias and Port to construct the uri for your REST endpoint. In this case, it would be
http://myorg-test.apigee.net:80
Now let's look at the next API that would tell you about the proxy basepath:
Get list of apis: curl -v https://api.enterprise.apigee.com/v1/o/{org}/apis Get api details: curl -v https://api.enterprise.apigee.com/v1/o/{org}/apis/{api} **Get api deployments: curl -v https://api.enterprise.apigee.com/v1/o/{org}/apis/{api}/deployments Get list of proxies for the deployed revision: curl -v https://api.enterprise.apigee.com/v1/o/{org}/apis/{api}/revisions/{rev}/proxies **Get proxy details for a given proxy endpoint: curl -v https://api.enterprise.apigee.com/v1/o/{org}/apis/{api}/revisions/{rev}/proxies/{proxy}
The proxy details api would return the basepath of the proxy. The same can be done for each proxy endpoint, if there are multiple proxies in your apiproxy. Here's a sample output from the API:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ProxyEndpoint name="default"> <Description></Description> <FaultRules/> <Flows/> <PostFlow name="PostFlow"> <Request/> <Response/> </PostFlow> <PreFlow name="PreFlow"> <Request> <Step> <Condition>proxy.pathsuffix MatchesPath "/test"</Condition> <FaultRules/> <Name>Quota</Name> </Step> </Request> <Response/> </PreFlow> <HTTPProxyConnection> <BasePath>/regex</BasePath> <Properties/> <VirtualHost>default</VirtualHost> <VirtualHost>secure</VirtualHost> </HTTPProxyConnection> <RouteRule name="noroute"/> </ProxyEndpoint>
You can now combine the BasePath and the uri constructed earlier to derive the complete REST endpoint. In this case, it would be:
http://myorg-test.apigee.net:80/regex
So given a apiproxy name, org and environment you can easily derive the rest.
You don't need all these apis, but I just listed down all of them for better illustration. You would only need the ones marked with **
@arghya das thanks for your response. Is there a time frame for the availability of this API?