Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Management API list Proxy URLs, deployed environment and Targets

Hello everyone,

is there any possibility to get the following information from a API Proxy using API Calls?

* proxy URL (url in which you will reach the proxy)

* Environment to which the proxy is deployed

* Target URLs of the proxy

you can "build" it using https://<host>:8443/v1/organizations/<o>/environments/<e>/virtualhosts/default and https://<host>:8443/v1/organizations/<o>/apis/<proxy>/revisions/<revision>/proxies/default/ but first you will habe to get first the list of revisions, check the latest.

I guess I could use the same way to obtain the deployment information, but I was able to see which revision is deployed to which environment, and therefore I couldn´t map it to the REST api for getting the basePath using the previously mentioned call.

In general, what we would like to do, is generate a small Overview of the deployed Proxy using the REST API

Solved Solved
0 7 2,530
1 ACCEPTED SOLUTION

Hi @EXTERNPINILLAOSCAR

Using this API, you can get the deployed revision of an API proxy for all environments. Using that revision, you can get the details of your API proxy using

https://{host}/v1/organizations/{org}/apis/{api}/revisions/{rev}/targets/{target}

View solution in original post

7 REPLIES 7

Hi @EXTERNPINILLAOSCAR

Using this API, you can get the deployed revision of an API proxy for all environments. Using that revision, you can get the details of your API proxy using

https://{host}/v1/organizations/{org}/apis/{api}/revisions/{rev}/targets/{target}

@EXTERNPINILLAOSCAR - did that resolve your issue ?

Hi, thanks for the answer. This one helped and now I have the target URL

 "connection": {
        "connectionType": "httpConnection",
        "uRL": "https://www.myTarget.com
    },

Do you know any API call to get the URL used to call this proxy? Meaning something like this https://apigee.com/myProxy

Thanks in advance

You will need to traverse and get the virtual host info from the proxy configuration

https://{host}/v1/o/{org}/apis/{api}/revisions/{rev}/proxies/default

And then get the Virtual host from the response. Then use the Get Virtual Host API to get that info

https://{host}/v1/o/{org}/e/{env}/virtualhosts/{vName}

Should return the host name and the earlier API call for proxy configuration should have the base path as well. If you append both, you can get the Proxy URL

Thanks, that really helped a lot.

Hi @ssvaidyanathan ,

Do we have similar one working in apigee hybrid? we observe below one giving 404 in hybrid and seems deprecated. Do we have alternative approach to get list of targets in proxy?

https://{host}/v1/o/{org}/apis/{api}/revisions/{rev}/targets

 

we observe below one giving 404 in hybrid and seems deprecated.

You are right. That interface is not supported on Apigee X or hybrid.

The workaround is to: Download each proxy bundle, then unzip it, and examine it for the targets. 

Here's an example script that does this:

https://github.com/DinoChiesa/apigee-edge-js-examples/blob/main/findProxyWithHttpTarget.js

If you can read nodejs code, you can see it follows the steps I just described.