Adding an ESXi host to a newly created "HostAndCluster" folder using REST API
search cancel

Adding an ESXi host to a newly created "HostAndCluster" folder using REST API

book

Article ID: 321359

calendar_today

Updated On:

Products

VMware Aria Suite VMware vSphere ESXi

Issue/Introduction

This article provides steps on adding an ESXi host to a newly created "HostAndCluster" folder using REST API.

Symptoms:
  • Running /vcenter/host with the following REST API spec to add an ESXi host fails.
  • You see a Response Code 400 similar to:

    {
      "spec": {
        "hostname": "host_name",
        "thumbprint_verification": "NONE",
        "folder": "folder_moid",
        "user_name": "user_name",
        "password": "password"
      }
    }

    Response:
    {
     "type": "com.vmware.vapi.std.errors.invalid_argument",
     "value": {
      "messages": [
       {
        "args": [
         "folder_moid"
        ],
        "default_message": "Folder with identifier 'folder_moid' does not exist or, this folder is not allowed to have a vSphere compute resource (host) as its child.",
        "id": "com.vmware.api.vcenter.host.folder.invalid"
       }
      ]
     }
    }

    Response Code 400


Environment

VMware vSphere ESXi 6.5
VMware vSphere ESXi 6.7
VMware vSphere ESXi 6.0

Resolution

This is a known issue affecting VMware vCenter Server 6.x and later versions.

Currently, there is no resolution.

Workaround:
To work around this issue, provide the SSL thumbprint to allow adding a host to the "HostAndCluster folder in the Datacenter.

For example:

{
"spec": {
     "thumbprint_verification": "THUMBPRINT",
     "hostname": "host_name",
     "user_name": "user_name",
     "folder": "folder_moid",
     "password": "password",
     "thumbprint": "C9:5F:15:46:89:B1:74:80:E0:D7:38:A6:E9:E6:7B:3F:D0:D6:0C:81"
    }
}