Management API how to list API's URLs

Hi all,

I would get full details about API from management, however can't find data about API URL, although basePath (expected '/no-target')

What I got till now:

https://<host>:8443/v1/o/<o>/apis/No-Target

{ "metaData": { "createdAt": 1473239992206, "createdBy": "<mail>", "lastModifiedAt": 1473924895716, "lastModifiedBy": "<mail>" }, "name": "No-Target", "revision": [ "1", "2" ] }

Not too much data, see that it has two revisions. By calling https://<host>:8443/v1/o/<o>/apis/No-Target/deployments found which is deployed where.

{ "environment": [ { "name": "test", "revision": [ { "configuration": { "basePath": "/", "steps": [] }, "name": "2", "server": [ { "status": "deployed", "type": [ "message-processor" ], "uUID": "<uUID>" }, { "status": "deployed", "type": [ "router" ], "uUID": "<uUID>" } ], "state": "deployed" } ] }, { "name": "prod", "revision": [ { "configuration": { "basePath": "/", "steps": [] }, "name": "1", "server": [ { "status": "deployed", "type": [ "message-processor" ], "uUID": "<uUID>" }, { "status": "deployed", "type": [ "router" ], "uUID": "<uUID>" } ], "state": "deployed" } ] } ], "name": "No-Target", "organization": "<o>" }

I excepted that basePath here will be '/no-target', but it is '/'. Next, checking revision

https://<host>:8443/v1/o/<o>/apis/No-Target/revisions/1, see proxyEndpoints:default which probably contain necessary informations:

{ "configurationVersion": { "majorVersion": 4, "minorVersion": 0 }, "contextInfo": "Revision 1 of application No-Target, in organization <o>", "createdAt": 1473239992206, "createdBy": "<mail>", "displayName": "No-Target", "lastModifiedAt": 1473239992206, "lastModifiedBy": "<mail>", "name": "No-Target", "policies": [], "proxyEndpoints": [ "default" ], "resourceFiles": { "resourceFile": [] }, "resources": [], "revision": "1", "targetEndpoints": [], "targetServers": [], "type": "Application" }

How to get details of it ?

Many Thanks

0 4 1,418
4 REPLIES 4

ok I found 🙂

https://<host>:8443/v1/o/<o>/apis/No-Target/revisions/1/proxies/default

{ "connection": { "basePath": "/no-target", "connectionType": "httpConnection", "virtualHost": [ "secure" ] },(...)

Hi, did you build then the URL manually or where you able to find some property for that (using API calls)?

I´m using https://localhost:8443/v1/organizations/<o>/environments/<e>/virtualhosts/default but I would like to avoid building it together part for part

Thanks in advance

@Sebastian Krajewski , Yep, Information is distributed across multiple APIs. Can you please let us know what exactly you are looking for ? Is it basePath ? Is it all the resource URLs under that proxy ?

I think the VirtualHosts API would be your best bet here. It won't show you all the full URLs, but it would at least show you the hostname.


For example, something like this will list all the VirtualHost objects, which you can then use to list all the HostAliases:

curl -X GET -u $USERID:$USERPASSWORD http://<MANAGEMENT_SERVER>:8080/v1/o/<ORG_NAME>/e/<ENVIRONMENT_NAME>/virtualhosts


For there, you can get all the aliases by doing a GET on each VirtualHost, for example:

curl -X GET -u $USERID:$USERPASSWORD http://<MANAGEMENT_SERVER>:8080/v1/o/<ORG_NAME>/e/<ENVIRONMENT_NAME>/virtualhosts/<VIRTUALHOST_NAME>;


The UI builds the URL dynamically based upon the VirtualHost(s) being referenced in the proxy + the basepath(s) of same.

The only option I can think of to obtain the full proxy URL is to combine the above method with a GET on the proxy metadata + a little jq (https://stedolan.github.io/jq/).

So, trying something like the following will get you all the basepaths for a given proxy revision:

curl -X GET -u $USERID:$USERPASSWORD http://<MANAGEMENT_SERVER>:8080/v1/o/<ORG_NAME>/apis/<API_PROXY_NAME>/revisions/<REVISION_NUMBER>; | jq .basepaths[]




Note in the final command above, the "| jq .basepaths[]" part. This will be your list of basepaths for that given revision. (Pro tip: use "| jq --raw-output .basepaths[]" if you instead would prefer the list in raw format, which it sounds like you need).


I hope this helps. This is the best I could come up with for you, as there is no built-in API to do this given that the UI is doing it dynamically.