1. Operations
2. content
3. library
4. item
5. download session

## content library item download session: create

Creates a new download session.

### Request:

#### HTTP request

POST https://{server}/rest/com/vmware/content/library/item/download-session

#### Request Body Structure:

- JSON
- XML

{
"client_token": "string",
"create_spec": {
"client_progress": 1,
"error_message": {
"args": [
"string",
"string"
],
"default_message": "string",
"id": "string"
},
"expiration_time": "2015-01-01T22:13:05.651Z",
"id": "obj-103",
"library_item_content_version": "string",
"library_item_id": "obj-103",
"state": "ACTIVE"
}
}
<?xml version="1.0" ?>
<ns0:Create-Input xmlns:ns0="http://vmware.com/content/library/item/download_session" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<create_spec>
<id>obj-103</id>
<library_item_id>obj-103</library_item_id>
<client_progress>1</client_progress>
<error_message>
<default_message>string</default_message>
<id>string</id>
<args-array>
<array-item>string</array-item>
<array-item>string</array-item>
</args-array>
</error_message>
<state>ACTIVE</state>
<expiration_time>2015-01-01T22:13:05.651Z</expiration_time>
<library_item_content_version>string</library_item_content_version>
</create_spec>
<client_token>string</client_token>
</ns0:Create-Input>

#### Request Body Parameters:

Name | Type | Description
--- | --- | ---
bold = required
client_token | string | Optional. A unique token generated by 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.
create_spec | download_session_model | Specification for the new download session to be created.
create_spec.id | string | The identifier of this download session. 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.DownloadSession`. 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.DownloadSession`.
create_spec.library_item_id | string | The identifier of the library item whose content is being downloaded. 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.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`.
create_spec.library_item_content_version | string | The content version of the library item whose content is being downloaded. This value is the content.library.item_model.content_version at the time when the session is created for the 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.
create_spec.error_message | localizable_message | If the session is in the ERROR status this property will have more details about the error. 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.
create_spec.error_message.id | string | Unique identifier of the localizable string or message template. This identifier is typically used to retrieve a locale-specific string or message template from a message catalog.
create_spec.error_message.default_message | string | The value of this localizable string or message template in the `en_US` (English) locale. If vapi.std.localizable_message.id refers to a message template, the default message will contain the substituted arguments. This value can be used by clients that do not need to display strings and messages in the native language of the user. It could also be used as a fallback if a client is unable to access the appropriate message catalog.
create_spec.error_message.args | string[] | Arguments to be substituted into a message template.
create_spec.client_progress | long | The progress that has been made with the download. This property is to be updated by the client during the download process to indicate the progress of its work in completing the download. The initial progress is 0 until updated by the client. The maximum value is 100, which indicates that the download is complete. 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 optional for the `update` operation.
create_spec.state | string | The current state (`ACTIVE`, `CANCELED`, `ERROR`) of the download session. The state of the download session. Value is one of: ACTIVE: The session is active. Individual files may be in the process of being transferred and may become ready for download at different times. CANCELED: The session has been canceled. On-going downloads may fail. The session will stay in this state until it is either deleted by the user or automatically cleaned up by the Content Library Service. ERROR: Indicates there was an error during the session lifecycle.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.
create_spec.expiration_time | date_time | Indicates the time after which the session will expire. The session is guaranteed not to expire before this time. 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.

### Response:

#### HTTP Status Code: 200

#### Representations:

- JSON
- XML

{
"value": "obj-103"
}
<?xml version="1.0" ?>
<ns0:Create-Result xmlns:ns0="http://vmware.com/content/library/item/download_session" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<value>obj-103</value>
</ns0:Create-Result>

#### Response Type:

Name | Type | Description
--- | --- | ---
bold = required
value | string | Identifier of the new download session being created.

#### Errors:

HTTP Status Code | Type | Description
--- | --- | ---
400 | invalid_argument | if the session specification is not valid.
404 | not_found | if the library item targeted by the download does not exist.