content library item downloadsession file: prepare

Requests a file to be prepared for download.

Request:

HTTP request

POST https://{server}/rest/com/vmware/content/library/item/downloadsession/file/id:{download_session_id}?~action=prepare

Path Parameters

Name Type Description
Required
download_session_id string Identifier of the download session.

Request Body Structure:

{
    "endpoint_type""HTTPS",
    "file_name""string"
}
<?xml version="1.0" ?>
<ns0:Prepare-Input xmlns:ns0="http://vmware.com/content/library/item/downloadsession/file" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <endpoint_type>HTTPS</endpoint_type>
  <file_name>string</file_name>
</ns0:Prepare-Input>

Request Body Parameters:

Name Type Description
bold = required
file_name string Name of the file requested for download.
endpoint_type string Optional. Endpoint type request, one of HTTPS, DIRECT. This will determine the type of the content.library.item.downloadsession.file.info.download_endpoint that is generated when the file is prepared. The DIRECT is only available to users who have the ContentLibrary.ReadStorage privilege.

Response:

HTTP Status Code: 200

Representations:

{
    "value"{
        "bytes_transferred"1,
        "checksum_info"{
            "algorithm""SHA1",
            "checksum""string"
        },
        "download_endpoint"{
            "ssl_certificate_thumbprint""string",
            "uri""http://myurl.com"
        },
        "error_message"{
            "args"[
                "string",
                "string"
            ],
            "default_message""string",
            "id""string"
        },
        "name""string",
        "size"1,
        "status""UNPREPARED"
    }
}
<?xml version="1.0" ?>
<ns0:Prepare-Result xmlns:ns0="http://vmware.com/content/library/item/downloadsession/file" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <value>
    <download_endpoint>
      <ssl_certificate_thumbprint>string</ssl_certificate_thumbprint>
      <uri>http://myurl.com</uri>
    </download_endpoint>
    <status>UNPREPARED</status>
    <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>
    <name>string</name>
    <bytes_transferred>1</bytes_transferred>
    <checksum_info>
      <checksum>string</checksum>
      <algorithm>SHA1</algorithm>
    </checksum_info>
    <size>1</size>
  </value>
</ns0:Prepare-Result>

Response Type:

Name Type Description
bold = required
value info File information containing the status of the request and the download link to the file.
value.name string The name of the file.

value.size long The file size, in bytes.

Optional. This field may not be available immediately. It is guaranteed to be set when the client finishes downloading the file.

value.bytes_transferred long The number of bytes that have been transferred by the server so far for making this file prepared for download. This value may stay at zero till the client starts downloading the file.

value.status string The preparation status (UNPREPARED, PREPARE_REQUESTED, PREPARING, PREPARED, ERROR) of the file.

Defines the state of the file in preparation for download. Value is one of:
UNPREPARED: The file hasn't been requested for preparation.
PREPARE_REQUESTED: A prepare has been requested, however the server hasn't started the preparation yet.
PREPARING: A prepare has been requested and the file is in the process of being prepared.
PREPARED: Prepare succeeded. The file is ready for download.
ERROR: Prepare failed.

value.download_endpoint transfer_endpoint Endpoint at which the file is available for download. The value is valid only when the content.library.item.downloadsession.file.info.status is PREPARED.

Optional. This field won't be set until the file status is PREPARED.

value.download_endpoint.uri URI Transfer endpoint URI. The supported URI schemes are: http, https, file, and ds.

An endpoint URI with the ds scheme specifies the location of the file on the datastore. The format of the datastore URI is:

  • ds:///vmfs/volumes/uuid/path

Some examples of valid file URI formats are:

  • file:///path
  • file:///C:/path
  • file://unc-server/path

When the transfer endpoint is a file or datastore location, the server can import the file directly from the storage backing without the overhead of streaming over HTTP.

value.download_endpoint.ssl_certificate_thumbprint string Thumbprint of the expected SSL certificate for this endpoint. Only used for HTTPS connections. The thumbprint is the SHA-1 hash of the DER encoding of the remote endpoint's SSL certificate. If set, the remote endpoint's SSL certificate is only accepted if it matches this thumbprint, and no other certificate validation is performed.

Optional. If not specified, standard certificate validation is performed.

value.checksum_info checksum_info The checksum information of the file. When the download is complete, you can retrieve the checksum from the get operation to verify the checksum for the downloaded file.

Optional. The checksum is always calculated for the downloaded file, but this field won't be set until the download is complete.

value.checksum_info.algorithm string The checksum algorithm (SHA1, MD5) used to calculate the checksum.

Optional. If not specified the default checksum algorithm is SH_a1.

value.checksum_info.checksum string The checksum value calculated with content.library.item.file.checksum_info.algorithm.

value.error_message localizable_message Error message for a failed preparation when the prepare status is ERROR.

Optional. This field won't be set unless there was an error with the file transfer.

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

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

value.error_message.args string[] Arguments to be substituted into a message template.

Errors:

HTTP Status Code Type Description
404 not_found if the download session does not exist.
400 invalid_argument if there is no file with the specified file_name.
403 unauthorized if the the download session wasn't created with the ContentLibrary.ReadStorage privilege and the caller requested a DIRECT endpoint type.