REST API - copy

content library item: copy

Copies a library item.

Copying a library item allows a duplicate to be made within the same or different library. The copy occurs by first creating a new library item, whose identifier is returned. The content of the library item is then copied asynchronously. This copy can be tracked as a task.

If the copy fails, Content Library Service will roll back the copy by deleting any content that was already copied, and removing the new library item. A failure during rollback may require manual cleanup by an administrator.

A library item cannot be copied into a subscribed library.

Request:

HTTP request

POST https://{server}/rest/com/vmware/content/library/item/id:{source_library_item_id}?~action=copy

Path Parameters

Name Type Description
Required
source_library_item_id string Identifier of the existing library item from which the content will be copied.

Request Body Structure:

{
    "client_token""string",
    "destination_create_spec"{
        "creation_time""2015-01-01T22:13:05.651Z",
        "last_modified_time""2015-01-01T22:13:05.651Z",
        "last_sync_time""2015-01-01T22:13:05.651Z",
        "description""string",
        "type""string",
        "version""string",
        "content_version""obj-103",
        "library_id""obj-103",
        "size"1,
        "cached"true,
        "name""string",
        "id""obj-103",
        "source_id""obj-103",
        "metadata_version""string"
    }
}

Request Body Parameters:

Name Type Description
bold = required
client_token string Optional. A unique token generated on the client for each copy 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 copy.
destination_create_spec item_model Specification for the new library item to be created.
destination_create_spec.id string A unique identifier for this library item.

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

destination_create_spec.library_id string The identifier of the content.library_model to which this item belongs.

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

destination_create_spec.content_version string The latest version of the file content list of this library item.

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.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.item.Version. 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.item.Version.

destination_create_spec.creation_time date_time The date and time when this library item 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.

destination_create_spec.description string A human-readable description for this library item.

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 remains unchanged.

destination_create_spec.last_modified_time date_time The date and time when the metadata for this library item was last changed.

This field is affected by changes to the properties or file content of this item. It is not modified by changes to the tags of the item, or by changes to the library which owns this item.

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.

destination_create_spec.last_sync_time date_time The date and time when this library item was last synchronized.

This field is updated every time a synchronization is triggered on the library item, including when a synchronization is triggered on the library to which this item belongs. The value is unset for a library item that belongs to 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.

destination_create_spec.metadata_version string A version number for the metadata of this library item.

This value is incremented with each change to the metadata of this item. Changes to name, description, and so on will increment this value. The value is not incremented by changes to the content or tags of the item or the library which owns it.

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.

destination_create_spec.name string A human-readable name for this library item.

The name may not be unset or an empty string. The name does not have to be unique, even within the same library.

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.

destination_create_spec.cached boolean The status that indicates whether the library item is on disk or not. The library item is cached when all its files are on disk.

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.

destination_create_spec.size long The library item size, in bytes. The size is the sum of the size used on the storage backing for all the files in the item. When the library item is not cached, the size is 0.

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.

destination_create_spec.type string An optional type identifier which indicates the type adapter plugin to use.

This field may be set to a non-empty string value that corresponds to an identifier supported by a type adapter plugin present in the Content Library Service. A type adapter plugin, if present for the specified type, can provide additional information and services around the item content. A type adapter can guide the upload process by creating file entries that are in need of being uploaded to complete an item.

The types and plugins supported by the Content Library Service can be queried using the content.type service.

Optional. This field is optional for the create and update operations. During creation, if the type is left unspecified, or if the type is specified but does not have a corresponding type support plugin, then the type of the library item is considered to be generic and all data is treated as generic files. During update, if the type is not specified, then it is not updated.

destination_create_spec.version string A version number that is updated on metadata changes. This value is used to validate update requests to provide optimistic concurrency of changes.

This value represents a number that is incremented every time library item properties, such as name or description, are changed. It is not incremented by changes to the file content of the library item, including adding or removing files. It is also not affected by tagging the library item.

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.

destination_create_spec.source_id string The identifier of the content.library.item_model to which this item is synchronized to if the item belongs to a subscribed library. The value is unset for a library item that belongs to 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.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.Item. 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.Item.

Response:

HTTP Status Code: 200

Representation:

{
    "value""obj-103"
}

Response Type:

Name Type Description
bold = required
value string The identifier of the new library item into which the content is being copied.

Errors:

HTTP Status Code Type Description
404 not_found if the library item with source_library_item_id does not exist, or if the library referenced by the content.library.item_model.library_id property of destination_create_spec does not exist.
400 invalid_argument if one of the following is true for the new library item:
  • name is empty
  • name exceeds 80 characters
  • description exceeds 2000 characters
400 invalid_element_type if the content.library.item_model.library_id property of destination_create_spec refers to a subscribed library.
500 resource_inaccessible if the copy operation failed because the source or destination library item is not accessible.
400 not_allowed_in_current_state if the content of the source library item specified by source_library_item_id, or the content of the target library specified by the library ID (see content.library.item_model.library_id) property of destination_create_spec has been deleted from the storage backings (see LibraryModel#storageBackings) associated with it.