Error: "405 Method Not Allowed" when running Cloud Director Cell Topology APIs
search cancel

Error: "405 Method Not Allowed" when running Cloud Director Cell Topology APIs

book

Article ID: 379729

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

  • Attempting to run the Cloud Director Cell Topology API calls, for example:

GET https://{api_host}/cloudapi/1.0.0/cells/topology
GET https://{api_host}/cloudapi/1.0.0/cells/current/topology
GET https://{api_host}/cloudapi/1.0.0/cells/{cellUrn}/topology

  • Making the API calls fail with an error of the form:

405 Method Not Allowed

"minorErrorCode": "METHOD_NOT_ALLOWED",
"message": "HTTP method not allowed",
"stackTrace": "com.vmware.vcloud.api.rest.toolkit.exceptions.MethodNotAllowedRestApiException: HTTP method not allowed..."

  • Making the Cloud Director Cell Topology API calls fail when run using the API Explorer.
  • Making the Cloud Director Cell Topology API calls succeed when using the alpha API version supported by the target Cloud Director instance in the Accept header.

Environment

VMware Cloud Director 10.5.x

VMware Cloud Director 10.6.x

Cause

This is a known issue in Cloud Director 10.5.x and 10.6.x where the Cloud Director Cell Topology API calls fail unless an alpha API version supported by the target Cloud Director instance is used in the Accept header.

The API Explorer never uses the alpha API version and will always encounter this issue.

Resolution

To workaround this issue make the Cloud Director Cell Topology API call succeed using the alpha API version supported by the target Cloud Director instance in the Accept header.

Query the API versions supported by a Cloud Director instance to confirm the available alpha API version:

GET https://{api_host}/api/versions

For example Cloud Director 10.6.0.1 would return the following alpha API version "40.0.0-alpha-1725002054":

<AlphaVersion deprecated="false">
<Version>40.0.0-alpha-1725002054</Version>
<LoginUrl>https://{api_host}/cloudapi/1.0.0/sessions</LoginUrl>
<ProviderLoginUrl>
https://{api_host}/cloudapi/1.0.0/sessions/provider
</ProviderLoginUrl>
</AlphaVersion>

Use the retrieved alpha API version in the Accept header when making the Cloud Director Cell Topology API calls and the request will succeed.
For example to query the Cell Group Topology Status from a Cloud Director 10.6.0.1 environment the following curl request could be made:

curl -X 'GET' \
  'https://{api_host}/cloudapi/1.0.0/cells/topology' \
  -H 'accept: application/json;version=40.0.0-alpha-1725002054' \
  -H 'Authorization: Bearer {api_token}'

NOTE: The {api_token} in the example above is the retrieved by logging into the Cloud Director API as a Provider user as outlined in the KB here, How to establish an API connection VMware Cloud Director.

Additional Information

For more information on the Cloud Director Cell Topology API calls see the documentation, VMware Cloud Director OpenAPI - Cell APIs.