Vcenter Ovf LibraryItem create

Vcenter Ovf LibraryItem create

Creates a library item in content library from a virtual machine or virtual appliance.

This operation creates a library item in content library whose content is an OVF package derived from a source virtual machine or virtual appliance, using the supplied create specification. The OVF package may be stored as in a newly created library item or in an in an existing library item. For an existing library item whose content is updated by this operation, the original content is overwritten. Meta data such as name and description is not updated for the exisitng library item.

Returns an authorization error if you do not have all of the privileges described as follows:

  • Operation execution requires System.Read.
  • The resource VirtualMachine or VirtualApp referenced by the property Vcenter Ovf LibraryItem DeployableIdentity.id requires VApp.Export.
  • The resource com.vmware.content.Library referenced by the property Vcenter Ovf LibraryItem CreateTarget.library_id requires ContentLibrary.AddLibraryItem.
  • The resource com.vmware.content.library.Item referenced by the property Vcenter Ovf LibraryItem CreateTarget.library_item_id requires System.Read.
Request
URI
POST
https://{api_host}/api/vcenter/ovf/library-item
COPY
Header Parameters
string
Client-Token
Optional

Client-generated token used to retry a request if the client fails to get a response from the server. If the original request succeeded, the result of that request will be returned, otherwise the operation will be retried.

If missing or null, the server will create a token.


Request Body

Request body for invoking operation: create

{
    "source": {
        "type": "string",
        "id": "string"
    },
    "target": "Vcenter Ovf LibraryItem CreateTarget Object",
    "create_spec": "Vcenter Ovf LibraryItem CreateSpec Object"
}
source
Required

The Vcenter Ovf LibraryItem DeployableIdentity schema describes the resource created by a deployment, or the source resource from which library item can be created, by specifying its resource type and resource identifier.

target
Required

The Vcenter Ovf LibraryItem CreateTarget schema specifies the target library item when capturing a virtual machine or virtual appliance as an OVF package in a library item in a content library. The target can be an existing library item, which will be updated, creating a new version, or it can be a newly created library item in a specified library. See POST /vcenter/ovf/library-item.

create_spec
Required

The Vcenter Ovf LibraryItem CreateSpec schema defines the information used to create or update a library item containing an OVF package.

Authentication
This operation uses the following authentication methods.
Responses
201

Information about the success or failure of the operation, along with the details of the result or failure.

Returns Vcenter Ovf LibraryItem CreateResult of type(s) application/json
"Vcenter Ovf LibraryItem CreateResult Object"
boolean
succeeded
Required

Whether the create operation completed successfully.

string
ovf_library_item_id
Optional

Identifier of the created or updated library item.

If missing or null, the create operation failed and Vcenter Ovf LibraryItem CreateResult.error will describe the error(s) that caused the failure.

When clients pass a value of this schema as a parameter, the property must be an identifier for the resource type: com.vmware.content.library.Item. When operations return a value of this schema as a response, the property will be an identifier for the resource type: com.vmware.content.library.Item.

error
Optional

Errors, warnings, and informational messages produced by the create operation.

If missing or null, no errors, warnings, or informational messages were reported by the create operation.


400

Vapi Std Errors InvalidArgument:

  • if createSpec contains invalid arguments.
  • if source describes an unexpected resource type.

Vapi Std Errors NotAllowedInCurrentState if the operation cannot be performed because of the specified virtual machine or virtual appliance's current state. For example, if the virtual machine configuration information is not available, or if the virtual appliance is running.

Returns Vapi Std Errors Error of type(s) application/json
"Vapi Std Errors Error Object"
array of object
messages
Required

Stack of one or more localizable messages for human error consumers.

The message at the top of the stack (first in the list) describes the error from the perspective of the operation the client invoked.

Each subsequent message in the stack describes the "cause" of the prior message.

object
data
Optional

Data to facilitate clients responding to the operation reporting a standard error to indicating that it was unable to complete successfully.

Operations may provide data that clients can use when responding to errors. Since the data that clients need may be specific to the context of the operation reporting the error, different operations that report the same error may provide different data in the error. The documentation for each each operation will describe what, if any, data it provides for each error it reports.

The Vapi Std Errors ArgumentLocations, Vapi Std Errors FileLocations, and Vapi Std Errors TransientIndication schemas are intended as possible values for this property. Vapi Std DynamicID may also be useful as a value for this property (although that is not its primary purpose). Some resources may provide their own specific schemas for use as the value of this property when reporting errors from their operations.

Some operations will not set this property when reporting errors.

string
error_type
Required

Discriminator field to help API consumers identify the structure type.

For more information see: Vapi Std Errors Error Type.

This property was added in vSphere API 6.7.2.

Can be missing or null for compatibility with preceding implementations.


404

if the virtual machine or virtual appliance specified by source does not exist.

if the library or library item specified by target does not exist.

Returns Vapi Std Errors NotFound of type(s) application/json
This response body class contains all of the following: InlineVapi Std Errors NotFound0
"Vapi Std Errors NotFound Object"

500

Vapi Std Errors ResourceInaccessible if there was an error accessing a file from the source virtual machine or virtual appliance.

Vapi Std Errors ResourceBusy if the specified virtual machine or virtual appliance is busy.

Returns Vapi Std Errors Error of type(s) application/json
"Vapi Std Errors Error Object"
array of object
messages
Required

Stack of one or more localizable messages for human error consumers.

The message at the top of the stack (first in the list) describes the error from the perspective of the operation the client invoked.

Each subsequent message in the stack describes the "cause" of the prior message.

object
data
Optional

Data to facilitate clients responding to the operation reporting a standard error to indicating that it was unable to complete successfully.

Operations may provide data that clients can use when responding to errors. Since the data that clients need may be specific to the context of the operation reporting the error, different operations that report the same error may provide different data in the error. The documentation for each each operation will describe what, if any, data it provides for each error it reports.

The Vapi Std Errors ArgumentLocations, Vapi Std Errors FileLocations, and Vapi Std Errors TransientIndication schemas are intended as possible values for this property. Vapi Std DynamicID may also be useful as a value for this property (although that is not its primary purpose). Some resources may provide their own specific schemas for use as the value of this property when reporting errors from their operations.

Some operations will not set this property when reporting errors.

string
error_type
Required

Discriminator field to help API consumers identify the structure type.

For more information see: Vapi Std Errors Error Type.

This property was added in vSphere API 6.7.2.

Can be missing or null for compatibility with preceding implementations.


Code Samples
COPY
                    curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '{"create_spec":"{}","source:"object","target":"{}"}' https://{api_host}/api/vcenter/ovf/library-item