BasePaths attribute in main xml file

There is a BasePaths attribute that is in the highest level XML file for a proxy. It looks like this field doesn't affect the proxy configuration at all. It seems to basically be metadata. However when someone updates their basepath in the proxies XML it doesn't update this field. This can make the v1/o/{organization}/apis/{proxyname}/revisions/{revisionnumber} response misleading. Could someone please help me understand that field better or explain a better API call to make to check what the basepath actually is?

Solved Solved
1 1 842
1 ACCEPTED SOLUTION

explain a better API call to make to check what the basepath actually is?

First, some background. There are two basepaths.

The basepath that you are probably familiar with is the basepath in the ProxyEndpoint.

Secondly there is a "deployment basepath", a basepath that operators can specify at runtime when deploying an API Proxy bundle. The deployment basepath is prepended to the ProxyEndpoint basepath to get an effective basepath.

Example

proxy basepath /proxy1
deployment basepath /20180614
effective basepath /20180614/proxy1
proxy listens at https://vhost-alias/20180614/proxy1

Keep in mind that a single proxy bundle can contain multiple ProxyEndpoints. The deployment basepath applies to each one in the way described above.

You may be wondering "How does one specify the deployment basepath?" Many Apigee operators are unaware of this capability, because it is not exposed in the Apigee Administrative UI. Also it is not documented by the proxy deployment API. But it's there, and it works, and you have observed the read-out of that value. Here's n example that specifies a deployment basepath during the deployment operation:

POST /v1/o/ORG/e/ENV/apis/APINAME/revisions/REV/deployments?basepath=/foo

If you specify no basepath queryparam during the deployment operation, then none is used, and each ProxyEndpoint gets an effective basepath that is equivalent to the proxy basepath.

Now, back to your question: how can you check the basepath?

The answer depends on which basepath you want to know. If you want to know the static basepath that is specified in the ProxyEndpoint, then you need to query the ProxyEndpoint resource. The Admin UI does this for you of course, and displays the value clearly. but it sounds like you want to query from within a script. Do that with an API call like this:

GET /v1/o/ORG/apis/APINAME/revisions/REVNUM/proxies/ENDPOINTNAME

When I use this API call I get this kind of response:

{
  "connection" : {
    "basePath" : "/proxy-basepath",
    "connectionType" : "httpConnection",
    "virtualHost" : [ "secure" ]
  },
  "connectionType" : "httpConnection",
  "description" : "Proxy Endpoint 1",
  "faultRules" : [ ],
  "flows" : [ ... ],
  "name" : "proxy-endpoint-name",
  "postClientFlow" : { ... },
  "postFlow" : { ... },
  "preFlow" : { ... },
  "routeRule" : [ {
    "empty" : true,
    "name" : "NoRouteRule"
  } ],
  "routeRuleNames" : [ "NoRouteRule" ],
  "type" : "Proxy"
}

If you want to know the effective basepath, you must compute the value, by prepending what you get when you query the deployment, with what you get when you query the endpoint (as above). Here's how you can query the deployment:

GET /v1/o/ORG/apis/APINAME/revisions/REVNUM/deployments

The response you get will be something like this:

{
  "aPIProxy" : "proxyname-here",
  "environment" : [ {
    "configuration" : {
      "basePath" : "/deployment-basepath",
      "configVersion" : "SHA-512:...",
      "steps" : [ ]
    },
    "name" : "environmentname-here",
    "server" : [ ... ],
    "state" : "deployed"
  } ],
  "name" : "2",
  "organization" : "org-name"
}

To get the effective basepath, prepend THAT "deployment basepath" to the proxy endpoint basepath. (You'll have to normalize, too, because a deployment basepath of / will result in a double-slash to start the basepath. )

As for your original question - the basepath in the main attribute file, I don't know what that is. I don't pay any attention to that.

View solution in original post

1 REPLY 1

explain a better API call to make to check what the basepath actually is?

First, some background. There are two basepaths.

The basepath that you are probably familiar with is the basepath in the ProxyEndpoint.

Secondly there is a "deployment basepath", a basepath that operators can specify at runtime when deploying an API Proxy bundle. The deployment basepath is prepended to the ProxyEndpoint basepath to get an effective basepath.

Example

proxy basepath /proxy1
deployment basepath /20180614
effective basepath /20180614/proxy1
proxy listens at https://vhost-alias/20180614/proxy1

Keep in mind that a single proxy bundle can contain multiple ProxyEndpoints. The deployment basepath applies to each one in the way described above.

You may be wondering "How does one specify the deployment basepath?" Many Apigee operators are unaware of this capability, because it is not exposed in the Apigee Administrative UI. Also it is not documented by the proxy deployment API. But it's there, and it works, and you have observed the read-out of that value. Here's n example that specifies a deployment basepath during the deployment operation:

POST /v1/o/ORG/e/ENV/apis/APINAME/revisions/REV/deployments?basepath=/foo

If you specify no basepath queryparam during the deployment operation, then none is used, and each ProxyEndpoint gets an effective basepath that is equivalent to the proxy basepath.

Now, back to your question: how can you check the basepath?

The answer depends on which basepath you want to know. If you want to know the static basepath that is specified in the ProxyEndpoint, then you need to query the ProxyEndpoint resource. The Admin UI does this for you of course, and displays the value clearly. but it sounds like you want to query from within a script. Do that with an API call like this:

GET /v1/o/ORG/apis/APINAME/revisions/REVNUM/proxies/ENDPOINTNAME

When I use this API call I get this kind of response:

{
  "connection" : {
    "basePath" : "/proxy-basepath",
    "connectionType" : "httpConnection",
    "virtualHost" : [ "secure" ]
  },
  "connectionType" : "httpConnection",
  "description" : "Proxy Endpoint 1",
  "faultRules" : [ ],
  "flows" : [ ... ],
  "name" : "proxy-endpoint-name",
  "postClientFlow" : { ... },
  "postFlow" : { ... },
  "preFlow" : { ... },
  "routeRule" : [ {
    "empty" : true,
    "name" : "NoRouteRule"
  } ],
  "routeRuleNames" : [ "NoRouteRule" ],
  "type" : "Proxy"
}

If you want to know the effective basepath, you must compute the value, by prepending what you get when you query the deployment, with what you get when you query the endpoint (as above). Here's how you can query the deployment:

GET /v1/o/ORG/apis/APINAME/revisions/REVNUM/deployments

The response you get will be something like this:

{
  "aPIProxy" : "proxyname-here",
  "environment" : [ {
    "configuration" : {
      "basePath" : "/deployment-basepath",
      "configVersion" : "SHA-512:...",
      "steps" : [ ]
    },
    "name" : "environmentname-here",
    "server" : [ ... ],
    "state" : "deployed"
  } ],
  "name" : "2",
  "organization" : "org-name"
}

To get the effective basepath, prepend THAT "deployment basepath" to the proxy endpoint basepath. (You'll have to normalize, too, because a deployment basepath of / will result in a double-slash to start the basepath. )

As for your original question - the basepath in the main attribute file, I don't know what that is. I don't pay any attention to that.