The Content Library API provides services that you can use to create and manage content libraries.

You can create a local library and publish it for the entire virtual environment. You can also subscribe to use the contents of a local library and enable automatic synchronization to ensure that you have the latest content.

You can perform content library operations by using HTTP requests. Some operations require you to specify parameters in the body of the HTTP request according to your environment. For details about the syntax of each HTTP request body, see the API Reference documentation.

Creating a Local Content Library

You can create a local content library by using the POST https://<vcenter_ip_address_or_fqdn>/api/content/local-library HTTP request.

Publishing an Existing Content Library

To make the library content available for other vCenter Server instances across the vSphere Automation environment, you must publish the library. Depending on your workflow, select a method for publishing the local library. You can publish a local library that exists in your vSphere Automation environment by using the POST https://<vcenter_ip_address_or_fqdn>/api/content/local-library/<library_id>?action=publish HTTP request.

Subscribing to a Content Library

You can subscribe to local content libraries. When you subscribe to a library, you must specify the backing storage for the library content. If the library requires basic authentication, you must also provide the correct user name and password. You can create a subscribed library by using the POST https://<vcenter_ip_address_or_fqdn>/api/content/subscribed-library HTTP request.

Synchronizing a Subscribed Content Library

When you subscribe to a published library, you can configure the settings for downloading and updating the library content. You can force the synchronization of a subscribed library by using the POST https://<vcenter_ip_address_or_fqdn>/api/content/subscribed-library/<library_id>?action=sync HTTP request.

Editing the Settings of a Content Library

You can update the settings of content library types in your virtual environment. You can update the settings of a local library by using the PATCH https://<vcenter_ip_address_or_fqdn>/api/content/local-library/<library_id> HTTP request. You can update the settings of a subscribed library by using the PATCH https://<vcenter_ip_address_or_fqdn>/api/content/subscribed-library/<library_id> HTTP request.

Removing the Content of a Subscribed Library

You can free storage space in your virtual environment by removing the subscribed library content that you no longer need.

You can create a subscribed library with the option to download the library content on demand. As a result, only the metadata for the library items is stored in the associated with the subscribed library storage. When you want to deploy a virtual machine from a VM temple in the subscribed library, you must synchronize the subscribed library to download the entire published library content. When you no longer need the VM template, you can use the POST https://<vcenter_ip_address_or_fqdn>/api/content/subscribed-library/<library_id>?action=evict HTTP request. You must provide the subscribed library ID to this function. As a result, the subscribed library content that is cached on the backing storage is deleted.

If the subscribed library is not configured to synchronize on demand, an exception is thrown. In this case the subscribed library always attempts to have the most recent published library content.

Delete a Content Library

When you no longer need a content library, you can use the Delete operation on either the Local Library or the Subscribed Library service depending on the library type. You can delete a local library by using the DELETE https://<vcenter_ip_address_or_fqdn>/api/content/local-library/<library_id> HTTP request. You can delete a subscribed library by using the DELETE https://<vcenter_ip_address_or_fqdn>/api/content/subscribed-library/<library_id> HTTP request.