The vCloud API supports downloading media images from a catalog.
Verify that the following conditions are met:
■
|
You are logged in as a user who has permission to download media images. |
■
|
You know the URL of the catalog item that references the media image. |
1 | Retrieve the XML representation of the catalog and examine the catalog items that it contains. |
2 | |
3 | Use the URL in the Entity element of the CatalogItem to retrieve the Media object. The Media element includes a Link element of the following form, where id is the id of the media image: <Link rel="enable" href="https://vcloud.example.com/api/media/id/action/enableDownload"/> |
4 | Enable the media image for download. Make a POST request to the action/enableDownload URL shown in Step 2. The response is a Task element. |
5 | When the task completes, retrieve the media item again. The Media object now includes a download URL for the media file. |
6 | Make a GET request to the download:default URL. The media file is downloaded to the current working directory. |
When you download a media file, you first enable the file for download.
POST https://vcloud.example.com/api/media/254/action/enableDownload
202 Accepted Content-Type: application/vnd.vmware.vcloud.task+xml ... <Task ... operation="Enabling download of Media database.iso (254)" ... > ... </Task>
The Task in the response tracks the creation of the downloadable image. When the task completes, retrieve the Media element again.
GET https://vcloud.example.com/api/media/254
The Media object now includes a download URL for the media file.
<Media ... > ... <Files> <File name="database.iso" bytesTransferred="0"> <Link rel="download:default" href="https://vcloud.example.com/transfer/.../database.iso" /> </File> </Files> ... </Media>
The download URL remains valid while a transfer session is in progress, and for a maximum of 60 minutes of transfer session idle time. A system administrator can change this default value. See Retrieve or Update System Settings.