The vCloud API supports uploading virtual media such as CD-ROM and floppy disk images.

The workflow for uploading media images is similar to the one described in Upload an OVF Package to Create a vApp Template.

Note

You cannot download media images.

Verify that the following conditions are met:

You have a media image to upload.

You are logged in as a user who has permission to upload media images.

You know the URL of the target vDC that will receive the upload. Retrieve the XML representation of your organization to see a list of the vDCs that it contains.

1

Find the add link for media in the target vDC.

This link has the following form:

<Link
      rel="add"
      type="application/vnd.vmware.vcloud.media+xml"
      href="https://vcloud.example.com/api/vdc/5/media" />
2

POST a media request to the server.

The request body is a Media element that includes information about the virtual media item to upload. See the request portion of Example: Upload a Media Image .

The server uses this information to create a Media object, then returns a representation of the object that contains an upload URL. See the response portion of Example: Upload a Media Image .

3

PUT the media file contents to the upload:default link in the response.

The procedure is the same as the one shown in Uploading Referenced Files.

Request:

POST https://vcloud.example.com/api/vdc/5/media
Content-Type: application/vnd.vmware.vcloud.media+xml
...
<?xml version="1.0" encoding="UTF-8"?>
<Media
   xmlns="http://www.vmware.com/vcloud/v1.5"
   name="database.iso" 
   size="51242131" 
   imageType="iso">
   <Description>ISO database image</Description>
</Media>

In addition to the File element that contains the upload:default URL, the response includes an Owner element and several Link elements that the server creates.

Response:

Content-Type: application/vnd.vmware.vcloud.media+xml
201 Created
...
<Media
   xmlns="http://www.vmware.com/vcloud/v1.5"
   size="3121215488"
   imageType="iso"
   status="0"
   name="database.iso"
   id="urn:vcloud:media:254"
   type="application/vnd.vmware.vcloud.media+xml"
   href="https://vcloud.example.com/api/media/254" ... >
   <Link
      rel="up"
      type="application/vnd.vmware.vcloud.vdc+xml"
      href="https://vcloud.example.com/api/vdc/5" />
   <Link
      rel="remove"
      href="https://vcloud.example.com/api/media/254" />
   <Description>ISO database image</Description>
   <Files>
      <File
         size="51242131"
         bytesTransferred="0"
         name="file">
         <Link
            rel="upload:default"
            href="https://vcloud.example.com/transfer/.../file" />
      </File>
   </Files>
   <Owner
      ...
   </Owner>
</Media>