Upload API Sample Code


Step-by-Step Guide to Integrating Upload API
1. To get Auth Token: https://api.screenname.aol.com

2. Create new DevId: http://dev.aol.com/keys

3. To Upload a Video: call the AOL Video Upload API as per the documentation


Sample PHP Code



Below is a PHP code sample that illustrates using the AOL Video Upload API to upload a video. It uses the PHP cURL library to perform the request. The parameters are all documented on the AOL Video Upload API documentation page.
<?php

 define(UPLOAD_CALL, 'http://upload.uncutvideo.aol.com/api/asset/upload');
 define(DEVID, 'your_devId_here');
 define(REFERER, 'your_referer_site_here');
 define(AUTH_TOKEN, 'your_openauth_token_here');
 define(FORMAT, 'xml');

 $data = array(
    'devId' => DEVID,
    'a' => AUTH_TOKEN,
    'referer' => REFERER,
    'f' => FORMAT,
    'title' => 'My nifty video',
    'desc' => 'A cool video uploaded with the AVU Upload API',
    'catName' => 'News',
    'reg' => 'US',
    'loc' => 'Florida',
    'tag' => 'cool,tech,api',
    'share' => 'pub',
    'notifyByEmail' => 'yes',
    'locale' => 'en-US',
    'datafile' => '@/path/of/file/to/upload/here'
 );

 /* define URL for call - the "devId", "referer" and "a" parameters must be passed both in the GET 
    query parameters and in the POST form data 
 */
 $ch = curl_init(UPLOAD_CALL."?devId=".DEVID."&referer=".REFERER."&a=".AUTH_TOKEN."&f=".FORMAT);

 curl_setopt($ch, CURLOPT_POST, 1);
 curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

 $postResult = curl_exec($ch);
 curl_close($ch);

 if ($postResult)
  echo "$postResult";
 else
  echo curl_error($ch);

?>