Error: 'ClientErrorException: HTTP 406 Not Acceptable'
search cancel

Error: 'ClientErrorException: HTTP 406 Not Acceptable'

book

Article ID: 429376

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

  • Attempting to run a Cloud Director API calls, for example:

    GET https://vcloud.example.com/api/vApp/vapp-7

  • Making the API call fails with an error of the form of:


    "stackTrace": "javax.ws.rs.ClientErrorException: HTTP 406 Not Acceptable"
    ...
    ...
    "message": "The request accept header is invalid.",
    "majorErrorCode": 406,
    "minorErrorCode": "NOT_ACCEPTABLE",
    "vendorSpecificErrorCode": null,


This issue occurs even if the same API calls or scripts worked successfully in previous versions of VMware Cloud Director.

Environment

VMware Cloud Director 10.6.x

Cause

This error occurs because the API version specified in the Accept header of the request is no longer supported by VMware Cloud Director 10.6.

Each major release of VCD deprecates older API versions that fall outside of the backward-compatibility window.

Resolution

To resolve this issue, you must update your API requests to use a supported version for VMware Cloud Director 10.6.

 

  1. Identify supported API versions:

    Send a GET request to the versions endpoint of your provider:

    curl -i -k https://<VCD_FQDN>/api/versions

    For example Cloud Director 10.6.1 would return the following API version "39.0":

        <VersionInfo deprecated="false">
            <Version>39.0</Version>
            <LoginUrl>https://<VCD_FQDN>/cloudapi/1.0.0/sessions</LoginUrl>
            <ProviderLoginUrl>https://<VCD_FQDN>/cloudapi/1.0.0/sessions/provider</ProviderLoginUrl>
        </VersionInfo>


  2. Update your request headers: Locate the Accept header in your API client or script. Update the version parameter to 39.0 (the default for VCD 10.6x) or another version confirmed as "supported" in Step 1.

    Example Header:

    Accept: application/*+json;version=39.0

  3. Re-run the API call. It should now return a 200 OK or the expected successful response.

 

 

Additional Information

See API Version Life Cycle in the APIs and SDKs section on the following page:

VMware Cloud Director 10.6 Overview
https://techdocs.broadcom.com/us/en/vmware-cis/cloud-director/vmware-cloud-director/10-6/overview.html