upload_video_url

Upload a video file to a TubeMogul user's account using file url.

Explorer

Explore this method

Request URL

http://api.oneload.com/api/v3

HTTP method

GET or POST

Special Requirements

The hash for this method is generated differently than the other methods. See Authenticating for details.

Arguments

NOTE: Unless otherwise denoted, strings are limited to 256 UTF-8 encoded characters.


title (string) - Required
The title of the video.
tags (comma-delimited string) - Required
The tags of the video.
description (string) - Required
The description of the video. (3000 character limit.)
category (integer) - Required
The category ID of the video. The available values are returned by listCategories.
file_url (string) - Required
The file url. (Currently supported extensions: .mpg, .mpeg, .avi, .mov, .mp4, .m4v, .wmv, and .flv)
campaign_id (string) - Optional
The campaign to associate the video with. If not specified, then the original campaign created for the user's account will be used.

Example Response

<?xml version="1.0" encoding="utf-8" ?>
<response stat="ok">
<uploadid>1032</uploadid>
</response>

Error Codes

Standard error codes plus:

10 : One or more required fields are empty
20 : There must be two or more non-identical tags
30 : The category string is invalid
80 : Invalid campaign ID
90 : The user has reached their monthly video uploads

Example Code

<?
# Your user token
$user_token '';

# Your partner ID
$partner_id '';

# Your secret key
$secret_key '';

#
# Api host URL
#
$apihost 'http://api.oneload.com/api/v3';

#
# Url to file. Make sure that it's a direct url
# and there is no authentication needed.
#
$file_url '';

#
# Required arguments
#
$method 'upload_video_url';
$now time();
$title 'Sample Title';
$tags 'some, sample, tags';
$description 'And a sample description.';

#
# Valid (integer) values are returned from listCategories
#
$category '';

#
# Creation of the hash for upload_video_url is special.
# Do NOT URL-encode any of these.
#
$hash_string $secret_key.
               
$user_token.
               
$method.
               
$partner_id.
               
$now.
               
$title.
               
$file_url;

$hash sha1($hash_string);

$poststring = array(
    
'date' => $now,
    
'userToken' => $user_token,
    
'partnerID' => $partner_id,
    
'title' => $title,
    
'tags' => $tags,
    
'description' => $description,
    
'category' => $category,
    
'file_url' => $file_url,
    
'method' => $method,
    
'auth' => $hash,
);


echo 
http_build_query($poststring);

# using cURL so we can easily pass the file along.
$ch curl_init();
curl_setopt($chCURLOPT_URL$apihost);
curl_setopt($chCURLOPT_POSTtrue);
curl_setopt($chCURLOPT_POSTFIELDS$poststring);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
$result curl_exec($ch);
curl_close($ch);
echo 
'<br /><br />Result: '.htmlspecialchars($result);
?>