Content Library delete

Content Library delete

Deletes the specified library.

The delete operation applies to all library types. Deleting a library will remove the entry immediately and begin an asynchronous task to remove all cached content for the library. If the asynchronous task fails, file content may remain on the storage backing. This content will require manual removal.

Since vSphere 9.1, deletion of a content library will trigger a usage check to determine whether any resource(s) have declared usage on the library via POST /content/library/{library}/usages. If one or more resources are using the library, the library deletion will be blocked by default to prevent accidental disruption of dependent workflows. If the deletion request is issued with POST /content/library/{libraryId}?action=force-delete, the usage check will be skipped and the library will be deleted regardless of its usage.

This operation was added in vSphere API 9.1.0.0.

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

  • The resource com.vmware.content.Library referenced by the parameter libraryId requires ContentLibrary.DeleteLibrary.
Request
URI
DELETE
https://{host}/api/content/library/{libraryId}
COPY
Path Parameters
string
libraryId
Required

Identifier of the library to delete.

The parameter must be an identifier for the resource type: com.vmware.content.Library.


Authentication
This operation uses the following authentication methods.
Responses
204

Success!

Operation doesn't return any data structure

400

if the library contains a library item that cannot be deleted in its current state. For example, the library item contains a virtual machine template and a virtual machine is checked out of the library item. If the library is currently used by other resource(s).

Returns Vapi Std Errors NotAllowedInCurrentState of type(s) application/json
This response body class contains all of the following: Vapi Std Errors Error
{
    "messages": [
        {
            "id": "string",
            "default_message": "string",
            "args": [
                "string"
            ],
            "params": {
                "params": {
                    "s": "string",
                    "dt": "string",
                    "i": 0,
                    "d": "number",
                    "l": {
                        "id": "string",
                        "params": {
                            "params": "Vapi Std LocalizationParam Object"
                        }
                    },
                    "format": "string",
                    "precision": 0
                }
            },
            "localized": "string"
        }
    ],
    "data": {},
    "error_type": "string"
}

404

if the library specified by libraryId does not exist.

Returns Vapi Std Errors NotFound of type(s) application/json
This response body class contains all of the following: Vapi Std Errors Error
{
    "messages": [
        {
            "id": "string",
            "default_message": "string",
            "args": [
                "string"
            ],
            "params": {
                "params": {
                    "s": "string",
                    "dt": "string",
                    "i": 0,
                    "d": "number",
                    "l": "Vapi Std NestedLocalizableMessage Object",
                    "format": "string",
                    "precision": 0
                }
            },
            "localized": "string"
        }
    ],
    "data": {},
    "error_type": "string"
}

Code Samples
COPY
                    curl -X DELETE -H 'Authorization: <value>' https://{api_host}/api/content/library/{libraryId}