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

How to use Management API to get Virtual Host and configured Basepath

Platform:  Apigee Edge

Using the Management API to get proxy / revision details, I encounter issues.

* The deployments calls all show "revision" : "configuration" : "basePath" as  "/"

* The api- revisions call reports "basepaths" from the "meta-data" display.
   ( This does not align to reality of the configured proxy basepath.)
   ( Meta data from cloned proxies must be manually updated by the engineer)

* The api- revisions call reports in "targets", the internal proxy name of the target.
   This does not equate to the VirtualHost attribute of " <HTTPProxyConnection>"


I really do not want to have to download the proxy bundle, unzip and interrogate the XML .

All ideas entertained !!

 

 

 

Solved Solved
0 2 192
1 ACCEPTED SOLUTION

This request

 

GET https://api.enterprise.apigee.com/v1/o/$org/apis/$apiname/revisions/$revision

 

...gives you the basepath as:

 

{
  "basepaths" : [ "/basepath-here" ],
  "configurationVersion" : {
    "majorVersion" : 4,
    "minorVersion" : 0
  },
  "contextInfo" : "Revision X of application APINAME, in organization ORG",
  ...,
  "proxyEndpoints" : [ "PROXY_ENDPOINT_NAME" ],
  ...

 

And for the vhosts, of course you need to query each ProxyEndpoint within the proxy. so

 

GET https://api.enterprise.apigee.com/v1/o/$org/apis/$apiname/revisions/$revision/proxies/$proxyEndpointName

 

...and that gives you a list of vhosts:

{
  "connection" : {
    "basePath" : "/basepath-for-proxyendpoint",
    "connectionType" : "httpConnection",
    "properties" : {
      "property" : [ ]
    },
    "virtualHost" : [ "vhost-name-here" ]
  },
  "connectionType" : "httpConnection",
  ...

 

View solution in original post

2 REPLIES 2

This request

 

GET https://api.enterprise.apigee.com/v1/o/$org/apis/$apiname/revisions/$revision

 

...gives you the basepath as:

 

{
  "basepaths" : [ "/basepath-here" ],
  "configurationVersion" : {
    "majorVersion" : 4,
    "minorVersion" : 0
  },
  "contextInfo" : "Revision X of application APINAME, in organization ORG",
  ...,
  "proxyEndpoints" : [ "PROXY_ENDPOINT_NAME" ],
  ...

 

And for the vhosts, of course you need to query each ProxyEndpoint within the proxy. so

 

GET https://api.enterprise.apigee.com/v1/o/$org/apis/$apiname/revisions/$revision/proxies/$proxyEndpointName

 

...and that gives you a list of vhosts:

{
  "connection" : {
    "basePath" : "/basepath-for-proxyendpoint",
    "connectionType" : "httpConnection",
    "properties" : {
      "property" : [ ]
    },
    "virtualHost" : [ "vhost-name-here" ]
  },
  "connectionType" : "httpConnection",
  ...

 

Heya Dino ... long time 😛

The content returned from the first call is taken from "BasePaths" attribute of proxy meta-data display. (accordion item top-left under Navigator). 

  • This is not maintained during proxy save and so can be out of sync with an adjusted <BasePath> attribute of the <HTTPProxyConnection> construct.
  • The same applies to meta-data "DisplayName" which is not updated during proxy clone.
    ( Project -> Save as new API proxy )

But all is not lost !

Both the "configured values" are evident in the second call which returns the values I am looking for !
Thank you !

This equates to the status call employed by the Edge UI

https://apigee.com/ws/proxy/organizations/$org/apis/$api/deployments/status


Both the VirtualHost definition and the configured BasePath in one call 🙂 

Regards,
Robin.