REST API - create

content library subscriptions: create

Creates a subscription of the published library. This operation was added in vSphere API 6.7.2.

Request:

HTTP request

POST https://{server}/rest/com/vmware/content/library/subscriptions/id:{library}

Path Parameters

Name Type Description
Required
library string Identifier of the published library.

Request Body Structure:

{
    "client_token""string",
    "spec"{
        "subscribed_library"{
            "subscribed_library""obj-103",
            "vcenter"{
                "hostname""string",
                "https_port"1
            },
            "location""LOCAL",
            "placement"{
                "cluster""obj-103",
                "folder""obj-103",
                "host""obj-103",
                "resource_pool""obj-103",
                "network""obj-103"
            },
            "target""CREATE_NEW",
            "new_subscribed_library"{
                "storage_backings"[
                    {
                        "datastore_id""obj-103",
                        "storage_uri""http://myurl.com",
                        "type""DATASTORE"
                    },
                    {
                        "datastore_id""obj-103",
                        "storage_uri""http://myurl.com",
                        "type""DATASTORE"
                    }
                ],
                "name""string",
                "automatic_sync_enabled"true,
                "description""string",
                "on_demand"true
            }
        }
    }
}

Request Body Parameters:

Name Type Description
bold = required
client_token string Optional. A unique token generated on the client for each creation request. The token should be a universally unique identifier (UUID), for example: b8a2a2e3-2314-43cd-a871-6ede0f429751. This token can be used to guarantee idempotent creation.
spec create_spec Specification for the subscription.
spec.subscribed_library create_spec_subscribed_library Specification for the subscribed library to be associated with the subscription. This attribute was added in vSphere API 6.7.2.

spec.subscribed_library.target string Specifies whether the target subscribed library should be newly created or an existing subscribed library should be used. This attribute was added in vSphere API 6.7.2.

Defines the options related to the target subscribed library which will be associated with the subscription. This enumeration was added in vSphere API 6.7.2. Value is one of:
CREATE_NEW: Create a new subscribed library. This constant was added in vSphere API 6.7.2.
USE_EXISTING: Use the specified existing subscribed library. This constant was added in vSphere API 6.7.2.

spec.subscribed_library.new_subscribed_library create_spec_new_subscribed_library Specification for creating a new subscribed library associated with the subscription. This attribute was added in vSphere API 6.7.2.

Optional. It is only relevant when target has value CREATE_NEW. This field is optional and it is only relevant when the value of target is CREATE_NEW.

spec.subscribed_library.new_subscribed_library.name string Name of the subscribed library. This attribute was added in vSphere API 6.7.2.

spec.subscribed_library.new_subscribed_library.description string Description of the subscribed library. This attribute was added in vSphere API 6.7.2.

Optional. If unset, the description will be an empty string.

spec.subscribed_library.new_subscribed_library.storage_backings storage_backing[] The list of default storage backings for this library.

The list must contain exactly one storage backing. Multiple default storage locations are not currently supported but may become supported in future releases.

. This attribute was added in vSphere API 6.7.2.

spec.subscribed_library.new_subscribed_library.automatic_sync_enabled boolean Specifies whether the library should participate in automatic library synchronization. This attribute was added in vSphere API 6.7.2.

spec.subscribed_library.new_subscribed_library.on_demand boolean Specifies whether a library item's content will be synchronized only on demand. This attribute was added in vSphere API 6.7.2.

spec.subscribed_library.subscribed_library string Identifier of the existing subscribed library to associate with the subscription. Only the subscribed libraries for which content.library.subscription_info.subscription_url property is set to the content.library.publish_info.publish_url of the published library can be associated with the subscription. This attribute was added in vSphere API 6.7.2.

Optional. It is only relevant when target has value USE_EXISTING. This field is optional and it is only relevant when the value of target is USE_EXISTING.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: com.vmware.content.Library. When operations return a value of this structure as a result, the field will be an identifier for the resource type: com.vmware.content.Library.

spec.subscribed_library.location string Location of the subscribed library relative to the published library. This attribute was added in vSphere API 6.7.2.

Defines the location of subscribed library relative to the published library. This enumeration was added in vSphere API 6.7.2. Value is one of:
LOCAL: The subscribed library belongs to the same vCenter instance as the published library. This constant was added in vSphere API 6.7.2.
REMOTE: The subscribed library belongs to a different vCenter instance than the published library. This constant was added in vSphere API 6.7.2.

spec.subscribed_library.vcenter create_spec_vcenter Specification for the subscribed library's vCenter Server instance. This attribute was added in vSphere API 6.7.2.

Optional. It is only relevant when location has value REMOTE. This field is optional and it is only relevant when the value of location is REMOTE.

spec.subscribed_library.vcenter.hostname string The hostname of the subscribed library's vCenter Server. This attribute was added in vSphere API 6.7.2.

spec.subscribed_library.vcenter.https_port long The HTTPS port of the vCenter Server instance where the subscribed library exists. This attribute was added in vSphere API 6.7.2.

Optional. If unset, port 443 will be used.

spec.subscribed_library.placement create_spec_placement Placement specification for the virtual machine template library items on the subscribed library. This attribute was added in vSphere API 6.7.2.

Optional. This field is currently required. In future, if this is unset, the system will attempt to choose a suitable placement specification for the virtual machine template items; if a placement specification cannot be chosen, publish of virtual machine template items will fail.

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

Optional. This field is currently required. In future, if this is unset, the system will attempt to choose a suitable folder for the virtual machine template; if a folder cannot be chosen, publishing a virtual machine template item will fail.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: Folder:VCenter. When operations return a value of this structure as a result, the field will be an identifier for the resource type: Folder:VCenter.

spec.subscribed_library.placement.cluster string Cluster onto which the virtual machine template 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.7.2.

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:VCenter. When operations return a value of this structure as a result, the field will be an identifier for the resource type: ClusterComputeResource:VCenter.

spec.subscribed_library.placement.resource_pool string Resource pool into which the virtual machine template should be placed. If host and resource_pool are both specified, resource_pool must belong to host. If cluster and resource_pool are both specified, resource_pool must belong to cluster. This attribute was added in vSphere API 6.7.2.

Optional. This field is currently required. In future, if this is unset, the system will attempt to choose a suitable resource pool for the virtual machine template; if a resource pool cannot be chosen, publish of virtual machine template item will fail.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: ResourcePool:VCenter. When operations return a value of this structure as a result, the field will be an identifier for the resource type: ResourcePool:VCenter.

spec.subscribed_library.placement.host string Host onto which the virtual machine template 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.7.2.

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

spec.subscribed_library.placement.network string Network that backs the virtual Ethernet adapters in the virtual machine template. This attribute was added in vSphere API 6.7.2.

Optional. If unset, the virtual Ethernet adapters will not be backed by a network.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: Network:VCenter. When operations return a value of this structure as a result, the field will be an identifier for the resource type: Network:VCenter.

Response:

HTTP Status Code: 200

Representation:

{
    "value""obj-103"
}

Response Type:

Name Type Description
bold = required
value string Subscription identifier.

Errors:

HTTP Status Code Type Description
400 already_exists If a subscription of the published library to the specified subscribed library already exists. This is only applicable when subscribedLibrary#subscribedLibrary is specified.
500 error If the system reports an error while responding to the request.
404 not_found If the library specified by library does not exist.
500 resource_inaccessible If the vCenter instance specified by subscribedLibrary#vcenter cannot be contacted or found.
400 invalid_argument If content.library.subscriptions.create_spec contains invalid arguments.
400 invalid_element_type If the library specified by library is a subscribed library.
400 not_allowed_in_current_state If the library specified by library is not a published library.
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.