REST API - check_out

vcenter vm template library items check outs: check out

Checks out a library item containing a virtual machine template. This operation makes a copy of the source virtual machine template contained in the library item as a virtual machine. The virtual machine is copied with the same storage specification as the source virtual machine template. Changes to the checked out virtual machine do not affect the virtual machine template contained in the library item. To save these changes back into the library item, check_in the virtual machine. To discard the changes, delete the virtual machine. This operation was added in vSphere API 6.9.1.

Request:

HTTP request

POST https://{server}/rest/vcenter/vm-template/library-items/{template_library_item}/check-outs?action=check-out

Path Parameters

Name Type Description
Required
template_library_item string Identifier of the content library item containing the source virtual machine template to be checked out.

Request Body Structure:

{
    "spec"{
        "name""string",
        "placement"{
            "cluster""obj-103",
            "folder""obj-103",
            "host""obj-103",
            "resource_pool""obj-103"
        },
        "powered_on"true
    }
}

Request Body Parameters:

Name Type Description
bold = required
spec check_out_spec Optional. Specification used to check out the source virtual machine template as a virtual machine.
spec.name string Name of the virtual machine to check out of the library item. This attribute was added in vSphere API 6.9.1.

Optional. This field is currently required. In the future, if this field is unset, the system will choose a suitable name for the virtual machine.

spec.placement placement_spec Information used to place the checked out virtual machine. This attribute was added in vSphere API 6.9.1.

Optional. This field is currently required. In the future, if this field is unset, the system will place the virtual machine on a suitable resource.

If specified, each field will be used for placement. If the fields result in disjoint placement, the operation will fail. If the fields along with the placement values of the source virtual machine template result in disjoint placement, the operation will fail.

.
spec.placement.folder string Virtual machine folder into which the virtual machine should be placed. This attribute was added in vSphere API 6.9.1.

Optional. If unset, the virtual machine will be placed in the same folder as the source virtual machine template.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: Folder. When operations return a value of this structure as a result, the field will be an identifier for the resource type: Folder.

spec.placement.resource_pool string Resource pool into which the virtual machine should be placed. This attribute was added in vSphere API 6.9.1.

Optional. If unset, the system will attempt to choose a suitable resource pool for the virtual machine; if a resource pool cannot be chosen, the operation will fail.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: ResourcePool. When operations return a value of this structure as a result, the field will be an identifier for the resource type: ResourcePool.

spec.placement.host string Host onto which the virtual machine should be placed. If host and resource_pool are both specified, resource_pool must belong to host. If host and cluster are both specified, host must be a member of cluster. This attribute was added in vSphere API 6.9.1.

Optional. This field may be unset if resource_pool or cluster is specified. If unset, the system will attempt to choose a suitable host for the virtual machine; if a host cannot be chosen, the operation will fail.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: HostSystem. When operations return a value of this structure as a result, the field will be an identifier for the resource type: HostSystem.

spec.placement.cluster string Cluster onto which the virtual machine should be placed. If cluster and resource_pool are both specified, resource_pool must belong to cluster. If cluster and host are both specified, host must be a member of cluster. This attribute was added in vSphere API 6.9.1.

Optional. If resource_pool or host is specified, it is recommended that this field be unset.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: ClusterComputeResource. When operations return a value of this structure as a result, the field will be an identifier for the resource type: ClusterComputeResource.

spec.powered_on boolean Specifies whether the virtual machine should be powered on after check out. This attribute was added in vSphere API 6.9.1.

Optional. If unset, the virtual machine will not be powered on after check out.

Response:

HTTP Status Code: 200

Representation:

{
    "value""obj-103"
}

Response Type:

Name Type Description
bold = required
value string Identifier of the virtual machine that was checked out of the library item.

Errors:

HTTP Status Code Type Description
400 already_exists if a virtual machine with the name specified by vcenter.vm_template.library_items.check_outs.check_out_spec.name already exists in the folder specified by vcenter.vm_template.library_items.check_outs.placement_spec.folder.
400 invalid_argument if spec contains invalid arguments.
404 not_found if the library item specified by template_library_item cannot be found.
500 resource_inaccessible if there is an error accessing the files of the source virtual machine template contained in the library item specified by template_library_item.
500 unable_to_allocate_resource if the limit for the number of virtual machines checked out of a library item (currently 1) has been exceeded.
401 unauthenticated if the user that requested the operation cannot be authenticated.
403 unauthorized if the user that requested the operation is not authorized to perform the operation.
500 error if the system reports an error while responding to the request.