This article exists to provide a workaround to resolve the errors encountered while using Deployment APIs on `/api` endpoint.
Symptoms:
vCenter Deployment APIs return 404 error response.
404 Error output:
=================
{
“messages”: [
{
“id”: “vapi.method.invoke.exception”,
“default_message”: “Error in method invocation The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.“,
“args”: [
“The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.”
]
}
],
“error_type”: “INVALID_REQUEST”
}
VMware vSphere 7.0.x
Starting vSphere release 7 Update 2, Rest API Modernization has been done. It deprecates `/rest` endpoint. All new APIs added starting vCenter Server 7.0U2 will be available only on `/api`, this will also host opre-existing APIs, but in a different style.
The `/rest` endpoint will continue to host APIs released prior to 7.0U2. With the API Modernization, the REST API reference documentation was updated to represent :443/api.
During deployment/Installation phase, port :443 is yet to been configured and not available. Hence, vCenter Deployment APIs can not accessed on port :443.
So requests like
https://{api_host}/api/vcenter/deployment/install?action=check fail.
These APIs are available on port :5480 but :5480 has no `/api` rendering. So requests like
https://{api_host}:5480/api/vcenter/deployment/install?action=check would also fail with the error described in the symptoms sections.
This issue will be fixed in the future releases.
Workaround:
Use port :5480 with `/rest` end point
e.g.
https://{api_host}:5480/rest/vcenter/deployment/install?action=check
The APIs on :5480/rest are similar to deprecated older :443/rest APIs
Refer to 7.0U2 programming update guide to use :5480/rest.
Following is an illustration of changes required to API requests.
--------------------------------------------------------------------
1. Authentication mechanism
--------------------------------------------------------------------
The vCenter Deployment group APIs support the following methods to authenticate requests:
a. API key
To authenticate using this mechanism, a session is acquired from Create Session API under CIS product.
POST https://<server>:5480/rest/com/vmware/cis/session
This requests returns a vmware-api-session-id
Example of a vmware-api-session-id:
"b00db39f948d13ea1e59b4d6fce56389"
The "vmware-api-session-id" and it's value has to be passed as a header while invoking the APIs.
b. Basic Authentication
To authenticate using this mechanism, pass the SSO credentials or the vCenter Server root credentials.
--------------------------------------------------------------------
2. Modify the request.
--------------------------------------------------------------------
Please modify and replace the API request to use /rest on port 5480 instead of /api
-------------
Example 1
-------------
Change
POST https://<server>/api/vcenter/deployment/install?action=check
to
POST https://<server>:5480/rest/vcenter/deployment/install?action=check
------------
Example 2
------------
Change
POST https://<server>/api/vcenter/deployment/install?action=start
to
POST https://<server>:5480/rest/vcenter/deployment/install?action=start
------------
Example 3
------------
Change
GET https://{server}/api/vcenter/deployment/install
to
GET https://{server}:5480/rest/vcenter/deployment/install
--------------------------------------------------------------------
3. Modify the payload body if applicable.
--------------------------------------------------------------------
Add the "spec" to the body
e.g.
Change
{
"vcsa_embedded": {
"ceip_enabled": false
}
}
to
{
"spec": {
"vcsa_embedded": {
"ceip_enabled": false
}
}
}