Create Content Subscribed Library

Create Content Subscribed Library

Creates a new subscribed library. Once created, the subscribed library will be empty. If the LibraryModel.subscription-info property is set, the Content Library Service will attempt to synchronize to the remote source. This is an asynchronous operation so the content of the published library may not immediately appear.

if you do not have all of the privileges described as follows:

  • Operation execution requires ContentLibrary.CreateSubscribedLibrary.
  • The resource Datastore referenced by the attribute StorageBacking.datastore-id requires Datastore.AllocateSpace.
Request
URI
POST
https://{api_host}/api/content/subscribed-library
COPY
Header Parameters
string
client_token
Optional

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. If not specified creation is not idempotent.


Request Body
LibraryModel of type(s) application/json
Required
{
    "id": "string",
    "creation_time": "string",
    "description": "string",
    "last_modified_time": "string",
    "last_sync_time": "string",
    "name": "string",
    "storage_backings": [
        {
            "type": "string",
            "datastore_id": "string",
            "storage_uri": "string"
        }
    ],
    "type": "string",
    "optimization_info": {
        "optimize_remote_publishing": false
    },
    "version": "string",
    "publish_info": {
        "authentication_method": "string",
        "published": false,
        "publish_url": "string",
        "user_name": "string",
        "password": "string",
        "current_password": "string",
        "persist_json_enabled": false
    },
    "subscription_info": {
        "authentication_method": "string",
        "automatic_sync_enabled": false,
        "on_demand": false,
        "password": "string",
        "ssl_thumbprint": "string",
        "subscription_url": "string",
        "user_name": "string",
        "source_info": {
            "source_library": "string",
            "subscription": "string"
        }
    },
    "server_guid": "string",
    "security_policy_id": "string",
    "unset_security_policy_id": false
}
string
id
Optional

An identifier which uniquely identifies this LibraryModel. This field is not used for the create operation. It will not be present in the result of the get or list operations. It is not used for the update operation. 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.

string As date-time
creation_time
Optional

The date and time when this library was created. This field is not used for the create operation. It will always be present in the result of the get or list operations. It is not used for the update operation.

string
description
Optional

A human-readable description for this library. This field is optional for the create operation. Leaving it unset during creation will result in an empty string value. It will always be present in the result of a get or list operation. It is optional for the update operation. Leaving it unset during update indicates that the description should be left unchanged.

string As date-time
last_modified_time
Optional

The date and time when this library was last updated. This field is updated automatically when the library properties are changed. This field is not affected by adding, removing, or modifying a library item or its content within the library. Tagging the library or syncing the subscribed library does not alter this field.

This field is not used for the create operation. It will always be present in the result of the get or list operations. It is not used for the update operation.

string As date-time
last_sync_time
Optional

The date and time when this library was last synchronized. This field applies only to subscribed libraries. It is updated every time a synchronization is triggered on the library. The value is unset for a local library.

This field is not used for the create operation. It is optional in the result of the get or list operations. It is not used for the update operation.

string
name
Optional

The name of the library. A Library is identified by a human-readable name. Library names cannot be undefined or an empty string. Names do not have to be unique.

This field must be provided for the create operation. It will always be present in the result of the get or list operations. It is optional for the update operation.

storage_backings
Optional

The list of default storage backings which are available for this library. A StorageBacking defines a default storage location which can be used to store files for library items in this library. Some library items, for instance, virtual machine template items, support files that may be distributed across various storage backings. One or more item files may or may not be located on the default storage backing.

Multiple default storage locations are not currently supported but may become supported in future releases.

This field must be provided for the create operation. It will always be present in the result of the get or list operations. It is not used for the update operation.

type
Optional

The LibraryModel.LibraryType enumerated type defines the type of a LibraryModel. The type of a library can be used to determine which additional services can be performed with a library.
LOCAL : The library contents are defined and stored by the local Content Library Service installation. A local library can be retrieved and managed via the LocalLibrary.
SUBSCRIBED : The library synchronizes its items and content from another published library. A subscribed library can be retrieved and managed via the SubscribedLibrary.

optimization_info
Optional

The OptimizationInfo structure defines different optimizations and optimization parameters applied to particular library.

string
version
Optional

A version number which is updated on metadata changes. This value allows clients to detect concurrent updates and prevent accidental clobbering of data. This value represents a number which is incremented every time library properties, such as name or description, are changed. It is not incremented by changes to a library item within the library, including adding or removing items. It is also not affected by tagging the library.

This field is not used for the create operation. It will always be present in the result of a get or list operation. It is optional for the update operation. Leaving it unset during update indicates that you do not need to detect concurrent updates.

publish_info
Optional

The PublishInfo structure defines how a local library is published publicly for synchronization to other libraries.

subscription_info
Optional

The SubscriptionInfo structure defines the subscription behavior for a subscribed library.

string
server_guid
Optional

The unique identifier of the vCenter server where the library exists. This field is optional for the create operation. It will always be present in the result of the get or list operations. It is not used for the update operation. When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: com.vmware.vcenter.VCenter. When operations return a value of this structure as a result, the field will be an identifier for the resource type: com.vmware.vcenter.VCenter.

string
security_policy_id
Optional

Represents the security policy applied to this library. Setting the field will make the library secure. This field is ignored in update operation if LibraryModel.unset-security-policy-id is set to true.

This field is optional for the create and update operations. If not set in create operation, the library will be insecure. If not specified in update operation, the field is left unchanged. 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.

boolean
unset_security_policy_id
Optional

This represents the intent of the change to LibraryModel.security-policy-id in update operation. If this field is set to true, any security policy applied to the library will be removed. If this field is set to false, any security policy applied to library will be changed to the value specified in LibraryModel.security-policy-id, if any.

This field is optional for the update operation. If unset, any existing security policy will be changed to the value specified in LibraryModel.security-policy-id, if any.

Authentication
This operation uses the following authentication methods.
Responses
201

Identifier of the newly created subscribed library. The result will be an identifier for the resource type: com.vmware.content.Library.

Returns string of type(s) application/json
Operation doesn't return any data structure

400

com.vmware.vapi.std.errors.invalid_argument : if the createSpec is not valid. if the clientToken does not conform to the UUID format. | com.vmware.vapi.std.errors.unsupported : if using multiple storage backings.

Returns Std_Errors_Error of type(s) application/json
{
    "messages": [
        {
            "id": "string",
            "default_message": "string",
            "args": [
                "string"
            ],
            "params": {
                "params": {
                    "s": "string",
                    "dt": "string",
                    "i": 0,
                    "d": "number",
                    "l": {
                        "id": "string",
                        "params": {
                            "params": "Std_LocalizationParam Object"
                        }
                    },
                    "format": "string",
                    "precision": 0
                }
            },
            "localized": "string"
        }
    ],
    "data": {},
    "error_type": "string"
}
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 ArgumentLocations, FileLocations, and TransientIndication structures are intended as possible values for this field. DynamicID may also be useful as a value for this field (although that is not its primary purpose). Some services may provide their own specific structures for use as the value of this field when reporting errors from their operations.

Some operations will not set this field when reporting errors.

error_type
Optional

Enumeration of all standard errors. Used as discriminator in protocols that have no standard means for transporting the error type, e.g. REST.
ERROR : Discriminator for the Error type.
ALREADY_EXISTS : Discriminator for the AlreadyExists type.
ALREADY_IN_DESIRED_STATE : Discriminator for the AlreadyInDesiredState type.
CANCELED : Discriminator for the Canceled type.
CONCURRENT_CHANGE : Discriminator for the ConcurrentChange type.
FEATURE_IN_USE : Discriminator for the FeatureInUse type.
INTERNAL_SERVER_ERROR : Discriminator for the InternalServerError type.
INVALID_ARGUMENT : Discriminator for the InvalidArgument type.
INVALID_ELEMENT_CONFIGURATION : Discriminator for the InvalidElementConfiguration type.
INVALID_ELEMENT_TYPE : Discriminator for the InvalidElementType type.
INVALID_REQUEST : Discriminator for the InvalidRequest type.
NOT_ALLOWED_IN_CURRENT_STATE : Discriminator for the NotAllowedInCurrentState type.
NOT_FOUND : Discriminator for the NotFound type.
OPERATION_NOT_FOUND : Discriminator for the OperationNotFound type.
RESOURCE_BUSY : Discriminator for the ResourceBusy type.
RESOURCE_IN_USE : Discriminator for the ResourceInUse type.
RESOURCE_INACCESSIBLE : Discriminator for the ResourceInaccessible type.
SERVICE_UNAVAILABLE : Discriminator for the ServiceUnavailable type.
TIMED_OUT : Discriminator for the TimedOut type.
UNABLE_TO_ALLOCATE_RESOURCE : Discriminator for the UnableToAllocateResource type.
UNAUTHENTICATED : Discriminator for the Unauthenticated type.
UNAUTHORIZED : Discriminator for the Unauthorized type.
UNEXPECTED_INPUT : Discriminator for the UnexpectedInput type.
UNSUPPORTED : Discriminator for the Unsupported type.
UNVERIFIED_PEER : Discriminator for the UnverifiedPeer type.


500

com.vmware.vapi.std.errors.resource_inaccessible : if subscribing to a published library which cannot be accessed.

Returns Std_Errors_Error of type(s) application/json
{
    "messages": [
        {
            "id": "string",
            "default_message": "string",
            "args": [
                "string"
            ],
            "params": {
                "params": {
                    "s": "string",
                    "dt": "string",
                    "i": 0,
                    "d": "number",
                    "l": {
                        "id": "string",
                        "params": {
                            "params": "Std_LocalizationParam Object"
                        }
                    },
                    "format": "string",
                    "precision": 0
                }
            },
            "localized": "string"
        }
    ],
    "data": {},
    "error_type": "string"
}
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 ArgumentLocations, FileLocations, and TransientIndication structures are intended as possible values for this field. DynamicID may also be useful as a value for this field (although that is not its primary purpose). Some services may provide their own specific structures for use as the value of this field when reporting errors from their operations.

Some operations will not set this field when reporting errors.

error_type
Optional

Enumeration of all standard errors. Used as discriminator in protocols that have no standard means for transporting the error type, e.g. REST.
ERROR : Discriminator for the Error type.
ALREADY_EXISTS : Discriminator for the AlreadyExists type.
ALREADY_IN_DESIRED_STATE : Discriminator for the AlreadyInDesiredState type.
CANCELED : Discriminator for the Canceled type.
CONCURRENT_CHANGE : Discriminator for the ConcurrentChange type.
FEATURE_IN_USE : Discriminator for the FeatureInUse type.
INTERNAL_SERVER_ERROR : Discriminator for the InternalServerError type.
INVALID_ARGUMENT : Discriminator for the InvalidArgument type.
INVALID_ELEMENT_CONFIGURATION : Discriminator for the InvalidElementConfiguration type.
INVALID_ELEMENT_TYPE : Discriminator for the InvalidElementType type.
INVALID_REQUEST : Discriminator for the InvalidRequest type.
NOT_ALLOWED_IN_CURRENT_STATE : Discriminator for the NotAllowedInCurrentState type.
NOT_FOUND : Discriminator for the NotFound type.
OPERATION_NOT_FOUND : Discriminator for the OperationNotFound type.
RESOURCE_BUSY : Discriminator for the ResourceBusy type.
RESOURCE_IN_USE : Discriminator for the ResourceInUse type.
RESOURCE_INACCESSIBLE : Discriminator for the ResourceInaccessible type.
SERVICE_UNAVAILABLE : Discriminator for the ServiceUnavailable type.
TIMED_OUT : Discriminator for the TimedOut type.
UNABLE_TO_ALLOCATE_RESOURCE : Discriminator for the UnableToAllocateResource type.
UNAUTHENTICATED : Discriminator for the Unauthenticated type.
UNAUTHORIZED : Discriminator for the Unauthorized type.
UNEXPECTED_INPUT : Discriminator for the UnexpectedInput type.
UNSUPPORTED : Discriminator for the Unsupported type.
UNVERIFIED_PEER : Discriminator for the UnverifiedPeer type.


default

'Default' means this response is used for all HTTP codes that are not covered individually for this operation.

Returns Std_Errors_Error of type(s) application/json
{
    "messages": [
        {
            "id": "string",
            "default_message": "string",
            "args": [
                "string"
            ],
            "params": {
                "params": {
                    "s": "string",
                    "dt": "string",
                    "i": 0,
                    "d": "number",
                    "l": {
                        "id": "string",
                        "params": {
                            "params": "Std_LocalizationParam Object"
                        }
                    },
                    "format": "string",
                    "precision": 0
                }
            },
            "localized": "string"
        }
    ],
    "data": {},
    "error_type": "string"
}
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 ArgumentLocations, FileLocations, and TransientIndication structures are intended as possible values for this field. DynamicID may also be useful as a value for this field (although that is not its primary purpose). Some services may provide their own specific structures for use as the value of this field when reporting errors from their operations.

Some operations will not set this field when reporting errors.

error_type
Optional

Enumeration of all standard errors. Used as discriminator in protocols that have no standard means for transporting the error type, e.g. REST.
ERROR : Discriminator for the Error type.
ALREADY_EXISTS : Discriminator for the AlreadyExists type.
ALREADY_IN_DESIRED_STATE : Discriminator for the AlreadyInDesiredState type.
CANCELED : Discriminator for the Canceled type.
CONCURRENT_CHANGE : Discriminator for the ConcurrentChange type.
FEATURE_IN_USE : Discriminator for the FeatureInUse type.
INTERNAL_SERVER_ERROR : Discriminator for the InternalServerError type.
INVALID_ARGUMENT : Discriminator for the InvalidArgument type.
INVALID_ELEMENT_CONFIGURATION : Discriminator for the InvalidElementConfiguration type.
INVALID_ELEMENT_TYPE : Discriminator for the InvalidElementType type.
INVALID_REQUEST : Discriminator for the InvalidRequest type.
NOT_ALLOWED_IN_CURRENT_STATE : Discriminator for the NotAllowedInCurrentState type.
NOT_FOUND : Discriminator for the NotFound type.
OPERATION_NOT_FOUND : Discriminator for the OperationNotFound type.
RESOURCE_BUSY : Discriminator for the ResourceBusy type.
RESOURCE_IN_USE : Discriminator for the ResourceInUse type.
RESOURCE_INACCESSIBLE : Discriminator for the ResourceInaccessible type.
SERVICE_UNAVAILABLE : Discriminator for the ServiceUnavailable type.
TIMED_OUT : Discriminator for the TimedOut type.
UNABLE_TO_ALLOCATE_RESOURCE : Discriminator for the UnableToAllocateResource type.
UNAUTHENTICATED : Discriminator for the Unauthenticated type.
UNAUTHORIZED : Discriminator for the Unauthorized type.
UNEXPECTED_INPUT : Discriminator for the UnexpectedInput type.
UNSUPPORTED : Discriminator for the Unsupported type.
UNVERIFIED_PEER : Discriminator for the UnverifiedPeer type.


Code Samples
COPY
                    curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '[{}]' https://{api_host}/api/content/subscribed-library
                
Power CLI Samples

# Module 'VMware.Sdk.vSphere.Content'

$LibraryStorageBacking = Initialize-LibraryStorageBacking -Type "DATASTORE" -DatastoreId "MyDatastoreId" -StorageUri "MyStorageUri" $LibraryOptimizationInfo = Initialize-LibraryOptimizationInfo -OptimizeRemotePublishing $false $LibraryPublishInfo = Initialize-LibraryPublishInfo -AuthenticationMethod "BASIC" -Published $false -PublishUrl "MyPublishUrl" -UserName "MyUserName" -Password "MyPassword" -CurrentPassword "MyCurrentPassword" -PersistJsonEnabled $false $LibrarySourceInfo = Initialize-LibrarySourceInfo -SourceLibrary "MySourceLibrary" -Subscription "MySubscription" $LibrarySubscriptionInfo = Initialize-LibrarySubscriptionInfo -AuthenticationMethod "BASIC" -AutomaticSyncEnabled $false -OnDemand $false -Password "MyPassword" -SslThumbprint "MySslThumbprint" -SubscriptionUrl "MySubscriptionUrl" -UserName "MyUserName" -SourceInfo $LibrarySourceInfo $LibraryModel = Initialize-LibraryModel -Id "MyId" -CreationTime (Get-Date) -Description "MyDescription" -LastModifiedTime (Get-Date) -LastSyncTime (Get-Date) -Name "MyName" -StorageBackings $LibraryStorageBacking -Type "LOCAL" -OptimizationInfo $LibraryOptimizationInfo -Version "MyVersion" -PublishInfo $LibraryPublishInfo -SubscriptionInfo $LibrarySubscriptionInfo -ServerGuid "MyServerGuid" -SecurityPolicyId "MySecurityPolicyId" -UnsetSecurityPolicyId $false Invoke-CreateContentSubscribedLibrary -LibraryModel $LibraryModel -ClientToken "MyClientToken"