Uploading media

Upload workflow

The upload process has two steps, you first have to retrieve an upload URL using the file object of the Cloud API and finally POST your file to this upload URL.

Get the upload URL

Request:

{
  "call": "file.upload",
  "args": {},
  "auth": "4c1a4d3edede832bfd000002:a8fe012836ddd0df62e6403d254b4ae6",
}

Response:

{
  "result": {
    "url": "http://upload-02.dmcloud.net/upload?uuid=ab91fc66c72a11dfa06f0026b9f94f64&seal=7074b95b20cd5aab0b723e660e419651"
  }
}

Post the Video file

In this step you will do a multipart POST on the URL returned in the previous step with the a file argument for the binary file data.

Response:

{
  'url': 'http://upload-02.dmcloud.net/files/1131afc3faee587a6d85e392bd7e7638.3gp',
  'seal': u'7dfe04a8cbb849b1ae0bf855e4f4ee17',
  'hash': u'a5074ec35069294cdd74938fb9e20f88f3a744c2',
  'name': 'video',
  'size': 92543
}

The response contains an URL that you can use as a parameter for the create method of the media object.

Example request:

{
  "call": "media.create",
  "args": {
    "url": "http://upload-02.dmcloud.net/files/1131afc3faee587a6d85e392bd7e7638.3gp",
    "assets_names": [
      "flv_h263_mp3",
      "mp4_h264_aac"
    ]
  },
  "auth": "4c1a4d3edede832bfd000002:25d56cdc1185b0a054f89a17263c1da6",
}

Example response:

{
  "result": {
    "id": "4c9b6917dede8351d600000a"
  }
}

Table Of Contents

Previous topic

Creating streaming URL

Next topic

Cloud API

This Page