Examples: Asset Requests

This page gives a few examples of using the Ad API endpoints for assets.

Note: Only successful responses are shown in the examples. Details about unsuccessful responses are found in the swagger documentation: https://api.videoplaza.com/v1/swagger.

Uploading Video Assets

You can upload video assets to Ooyala Pulse through the Ad API by providing, in the request body, either:
  • a URL to the video asset, or
  • the video asset itself as an octet-stream.

Transcoding starts when the video asset is linked to an ad. For more information, refer to Examples: Ad Requests.

Example: upload a video asset by providing a URL

Request header:

POST v1/assets/video HTTP/1.1
Host: api.videoplaza.com
Content-type: application/json
x-o-api-key="<your key>"

Request body:

{
  "name":"videoname.mp4",
  "downloadUri":"http://example.com/video/1234"
}
Note: The name parameter in the body needs to contain the correct file extension for the asset.

Success response:

HTTP status:
  201 (created)

Header:
  Location: <URI with the location of your asset>

Example: upload a video asset by providing the serialised asset

Request header:

POST v1/assets/video?fileName='videoname.mp4' HTTP/1.1
Host: api.videoplaza.com
Content-type: application/octet-stream
x-o-api-key="<your key>"

Request body:

<your video asset as an octet-stream>

Success response:

HTTP status:
  201 (created)

Header:
  Location: <URI with the location of your asset>

Uploading Other Assets

Note: Assets uploaded through this endpoint are never transcoded, which means retrieving asset metadata always returns "transcondingStatus": NOT_AVAILABLE.
You can upload other asset types, like ad images and flash files, to Ooyala Pulse through the Ad API by providing, in the request body, either:
  • a URL to the asset, or
  • the asset itself as an octet-stream.

For information on how to link an asset to an ad, refer to Examples: Ad Requests.

Example: upload an image asset by providing a URL

Request header:

POST v1/assets/resource HTTP/1.1
Host: api.videoplaza.com
Content-type: application/json
x-o-api-key="<your key>"

Request body:

{
  "name":"imagename.jpeg",
  "downloadUri":"http://example.com/image/1234"
}
Note: The name parameter in the body needs to contain the correct file extension for the asset.

Success response:

HTTP status:
  201 (created)

Header:
  Location: <URI with the location of your asset>

Example: upload an image asset by providing the serialised asset

Request header:

POST v1/assets/resource?fileName='imagename.jpeg' HTTP/1.1
Host: api.videoplaza.com
Content-type: application/octet-stream
x-o-api-key="<your key>"

Request body:

<your asset as an octet-stream>

Success response:

HTTP status:
  201 (created)

Header:
  Location: <URI with the location of your asset>

Retrieving Asset Metadata

To retrieve the metadata (name and transcoding status) for an asset, formulate a request as follows.

Request header:

GET v1/assets/<your asset's id> HTTP/1.1
Host: api.videoplaza.com
Content-type: application/json
x-o-api-key="<your key>"

Request body: NA

Success response:

HTTP status:
  200 (OK)

Body:
{
  "name":"filename.mp4",
  "id":"<your asset's id>",
  "transcondingStatus":"<NOT_AVAILABLE|FAILED|INITIAL|UPLOADING|TRANSCODING|DOWNLOADING|FINISHED>"
}

Was this article helpful?