REST API - update

content library: update

Updates the properties of a library.

This is an incremental update to the library. Any field in the content.library_model structure that is unset will not be modified.

This operation will only update the common properties for all library types. This will not, for example, update the content.library_model.publish_info of a local library, nor the content.library_model.subscription_info of a subscribed library. Specific properties are updated in update and update.

Request:

HTTP request

PATCH https://{server}/rest/com/vmware/content/library/id:{library_id}

Path Parameters

Name Type Description
Required
library_id string Identifier of the library to update.

Request Body Structure:

{
    "update_spec"{
        "creation_time""2015-01-01T22:13:05.651Z",
        "storage_backings"[
            {
                "datastore_id""obj-103",
                "storage_uri""http://myurl.com",
                "type""DATASTORE"
            },
            {
                "datastore_id""obj-103",
                "storage_uri""http://myurl.com",
                "type""DATASTORE"
            }
        ],
        "last_modified_time""2015-01-01T22:13:05.651Z",
        "optimization_info"{
            "optimize_remote_publishing"true
        },
        "server_guid""obj-103",
        "last_sync_time""2015-01-01T22:13:05.651Z",
        "description""string",
        "type""LOCAL",
        "version""string",
        "subscription_info"{
            "authentication_method""BASIC",
            "password""secret string",
            "user_name""string",
            "ssl_thumbprint""string",
            "automatic_sync_enabled"true,
            "subscription_url""http://myurl.com",
            "source_info"{
                "source_library""obj-103",
                "subscription""obj-103"
            },
            "on_demand"true
        },
        "name""string",
        "publish_info"{
            "authentication_method""BASIC",
            "password""secret string",
            "user_name""string",
            "published"true,
            "publish_url""http://myurl.com",
            "persist_json_enabled"true,
            "current_password""secret string"
        },
        "id""obj-103"
    }
}

Request Body Parameters:

Name Type Description
bold = required
update_spec library_model Specification of the new property values to set on the library.
update_spec.id string An identifier which uniquely identifies this library_model.

Optional. 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.

update_spec.creation_time date_time The date and time when this library was created.

Optional. 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.

update_spec.description string A human-readable description for this library.

Optional. 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.

update_spec.last_modified_time date_time 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.

Optional. 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.

update_spec.last_sync_time date_time 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.

Optional. 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.

update_spec.name string 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.

Optional. 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.

update_spec.storage_backings storage_backing[] The list of default storage backings which are available for this library.

A content.library.storage_backing 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.

Optional. 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.

update_spec.storage_backings[].type string Type (DATASTORE, OTHER) of content.library.storage_backing.

Specifies the type of the content.library.storage_backing. Value is one of:
DATASTORE: The content of the library will be stored on a datastore.

These are vCenter Server managed datastores, and are logical containers that hide specifics of each storage device. Depending on the type of storage you use, datastores can be backed by the following file system formats:

  • Virtual Machine File System (VMFS)
  • Network File System (NFS)


OTHER: The content of the library will be stored on a remote file system.

Supports the following remote file systems:

  • NFS (on vCenter Server Appliance)
  • SMB (on vCenter Server Appliance and vCenter Server for Windows)

Optional. 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.
update_spec.storage_backings[].datastore_id string Identifier of the datastore used to store the content in the library.

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

update_spec.storage_backings[].storage_uri URI URI identifying the location used to store the content in the library.

The following URI formats are supported:

vSphere 6.5

  • nfs://server/path?version=4 (for vCenter Server Appliance only) - Specifies an NFS Version 4 server.
  • nfs://server/path (for vCenter Server Appliance only) - Specifies an NFS Version 3 server. The nfs://server:/path format is also supported.
  • smb://server/path - Specifies an SMB server or Windows share.

vSphere 6.0 Update 1

  • nfs://server:/path (for vCenter Server Appliance only)
  • file://unc-server/path (for vCenter Server for Windows only)
  • file:///mount/point (for vCenter Server Appliance only) - Local file URIs are supported only when the path is a local mount point for an NFS file system. Use of file URIs is strongly discouraged. Instead, use an NFS URI to specify the remote file system.

vSphere 6.0

  • nfs://server:/path (for vCenter Server Appliance only)
  • file://unc-server/path (for vCenter Server for Windows only)
  • file:///path - Local file URIs are supported but strongly discouraged because it may interfere with the performance of vCenter Server.

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

update_spec.type string The type (LOCAL, SUBSCRIBED) of this library.

This value can be used to determine what additional services and information can be available for this library. This field is not used for the create and update operations. It will always be present in the result of a get operation.

Defines the type of a content.library_model.

The type of a library can be used to determine which additional services can be performed with a library.

Value is one of:
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 content.local_library.


SUBSCRIBED: The library synchronizes its items and content from another published library.

A subscribed library can be retrieved and managed via the content.subscribed_library.

Optional. 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.
update_spec.optimization_info optimization_info Defines various optimizations and optimization parameters applied to this library.

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

update_spec.optimization_info.optimize_remote_publishing boolean If set to true then library would be optimized for remote publishing.

Turn it on if remote publishing is dominant use case for this library. Remote publishing means here that publisher and subscribers are not the part of the same Vcenter SSO domain.

Any optimizations could be done as result of turning on this optimization during library creation. For example, library content could be stored in different format but optimizations are not limited to just storage format.

Note, that value of this toggle could be set only during creation of the library and you would need to migrate your library in case you need to change this value (optimize the library for different use case).

Optional. This field is optional for the create operation. If not specified for the create, the default is for the library to not be optmized for specific use case. It is not used for the update operation.

update_spec.version string 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.

Optional. 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.

update_spec.publish_info publish_info Defines how this library is published so that it can be subscribed to by a remote subscribed library.

The content.library.publish_info defines where and how the metadata for this local library is accessible. A local library is only published publically if content.library.publish_info.published is true.

Optional. This field is optional for the create and update operations. If not specified during creation, the default is for the library to not be published. If not specified during update, the field is left unchanged.

update_spec.publish_info.authentication_method string Indicates how a subscribed library should authenticate (BASIC, NONE) to the published library endpoint.

Indicates how a subscribed library should authenticate to the published library endpoint. Value is one of:
BASIC: Require HTTP Basic authentication matching a specified username and password.
NONE: Require no authentication.Optional. This field is required for the create operation. It is optional for the update operation, and if unset the value will not be changed. When the existing authentication method is BASIC and authentication is being turned off by updating this field to NONE, then the content.library.publish_info.current_password field is required. This field will always be present in the results of the get operation.

update_spec.publish_info.published boolean Whether the local library is published.

Optional. This field is required for the create operation. It is optional for the update operation, and if unset the value will not be changed. When the existing authentication method is BASIC and the local library is published, the content.library.publish_info.current_password field is required before turning off publishing. This field will always be present in the results of the get operation.

update_spec.publish_info.publish_url URI The URL to which the library metadata is published by the Content Library Service.

This value can be used to set the content.library.subscription_info.subscription_url property when creating a subscribed library.

Optional. 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.

update_spec.publish_info.user_name string The username to require for authentication.

Optional. This field is optional for the create and update operations. When the authentication method is NONE, the username can be left unset. When the authentication method is BASIC, the username is ignored in the current release. It defaults to "vcsp". It is preferable to leave this unset. If specified, it must be set to "vcsp".

update_spec.publish_info.password secret The new password to require for authentication.

Optional. This field is optional for the create operation. When the authentication method is NONE, the password can be left unset. When the authentication method is BASIC, the password should be a non-empty string. This field is optional for the update operation. Leaving it unset during update indicates that the password is not changed. When the password is changed, the content.library.publish_info.current_password field is required. This field is not used for the get operation.

update_spec.publish_info.current_password secret The current password to verify. This field is available starting in vSphere 6.7.

Optional. This field is unused for the create operation. This field is optional for the update operation. When the existing authentication method is NONE, the current password can be left unset. When the existing authentication method is BASIC, the current password is verified before applying the new content.library.publish_info.password, turning off authentication, or unpublishing the library. This field is not used for the get operation.

update_spec.publish_info.persist_json_enabled boolean Whether library and library item metadata are persisted in the storage backing as JSON files. This flag only applies if the local library is published.

Enabling JSON persistence allows you to synchronize a subscribed library manually instead of over HTTP. You copy the local library content and metadata to another storage backing manually and then create a subscribed library referencing the location of the library JSON file in the content.library.subscription_info.subscription_url. When the subscribed library's storage backing matches the subscription URL, files do not need to be copied to the subscribed library.

For a library backed by a datastore, the library JSON file will be stored at the path contentlib-{library_id}/lib.json on the datastore.

For a library backed by a remote file system, the library JSON file will be stored at {library_id}/lib.json in the remote file system path.

Optional. This field is optional 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.

update_spec.subscription_info subscription_info Defines the subscription behavior for this Library.

The content.library.subscription_info defines how this subscribed library synchronizes to a remote source. Setting the value will determine the remote source to which the library synchronizes, and how. Changing the subscription will result in synchronizing to a new source. If the new source differs from the old one, the old library items and data will be lost. Setting content.library.subscription_info.automatic_sync_enabled to false will halt subscription but will not remove existing cached data.

Optional. This field is optional for the create and update operations. If not specified during creation, a default will be created without an active subscription. If not specified during update, the field is left unchanged.

update_spec.subscription_info.authentication_method string Indicate how the subscribed library should authenticate (BASIC, NONE) with the published library endpoint.

Indicate how the subscribed library should authenticate with the published library endpoint. Value is one of:
BASIC: Require HTTP Basic authentication matching a specified username and password.
NONE: Require no authentication.Optional. 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.

update_spec.subscription_info.automatic_sync_enabled boolean Whether the library should participate in automatic library synchronization. In order for automatic synchronization to happen, the global content.configuration_model.automatic_sync_enabled option must also be true. The subscription is still active even when automatic synchronization is turned off, but synchronization is only activated with an explicit call to sync or sync. In other words, manual synchronization is still available even when automatic synchronization is disabled.

Optional. 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.

update_spec.subscription_info.on_demand boolean Indicates whether a library item's content will be synchronized only on demand.

If this is set to true, then the library item's metadata will be synchronized but the item's content (its files) will not be synchronized. The Content Library Service will synchronize the content upon request only. This can cause the first use of the content to have a noticeable delay.

Items without synchronized content can be forcefully synchronized in advance using the sync call with forceSyncContent set to true. Once content has been synchronized, the content can removed with the evict call.

If this value is set to false, all content will be synchronized in advance.

Optional. 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.

update_spec.subscription_info.password secret The password to use when authenticating.

The password must be set when using a password-based authentication method; empty strings are not allowed.

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

update_spec.subscription_info.ssl_thumbprint string An optional SHA-1 hash of the SSL certificate for the remote endpoint.

If this value is defined the SSL certificate will be verified by comparing it to the SSL thumbprint. The SSL certificate must verify against the thumbprint. When specified, the standard certificate chain validation behavior is not used. The certificate chain is validated normally if this value is unset.

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

update_spec.subscription_info.subscription_url URI The URL of the endpoint where the metadata for the remotely published library is being served.

This URL can be the content.library.publish_info.publish_url of the published library (for example, https://server/path/lib.json).

If the source content comes from a published library with content.library.publish_info.persist_json_enabled, the subscription URL can be a URL pointing to the library JSON file on a datastore or remote file system. The supported formats are:

vSphere 6.5

  • ds:///vmfs/volumes/{uuid}/mylibrary/lib.json (for datastore)
  • nfs://server/path/mylibrary/lib.json (for NFSv3 server on vCenter Server Appliance)
  • nfs://server/path/mylibrary/lib.json?version=4 (for NFSv4 server on vCenter Server Appliance)
  • smb://server/path/mylibrary/lib.json (for SMB server)

vSphere 6.0

  • file://server/mylibrary/lib.json (for UNC server on vCenter Server for Windows)
  • file:///path/mylibrary/lib.json (for local file system)

When you specify a DS subscription URL, the datastore must be on the same vCenter Server as the subscribed library. When you specify an NFS or SMB subscription URL, the content.library.storage_backing.storage_uri of the subscribed library must be on the same remote file server and should share a common parent path with the subscription URL.

Optional. 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.

update_spec.subscription_info.user_name string The username to use when authenticating.

The username must be set when using a password-based authentication method. Empty strings are allowed for usernames.

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

update_spec.subscription_info.source_info source_info Information about the source published library. This field will be set for a subscribed library which is associated with a subscription of the published library. This attribute was added in vSphere API 6.7.2.

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

update_spec.subscription_info.source_info.source_library string Identifier of the published library. This attribute was added in vSphere API 6.7.2.

Optional. 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.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.

update_spec.subscription_info.source_info.subscription string Identifier of the subscription associated with the subscribed library. This attribute was added in vSphere API 6.7.2.

Optional. 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.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.Subscriptions. 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.Subscriptions.

update_spec.server_guid string The unique identifier of the vCenter server where the library exists.

Optional. 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.

Response:

HTTP Status Code: 200

None

Errors:

HTTP Status Code Type Description
404 not_found if the library associated with library_id does not exist.
400 invalid_argument if the update_spec is not valid.