- Intro
- Authenticating
- get_video_status

- launch_video

- launch_cross_post

- launch_destination

- launch_feed

- list_available_sites

- list_available_destinations

- list_available_feeds

- list_available_cross_post_sites

- list_categories

- list_campaigns

- list_uploads

- list_upload_video_stats

- upload_video

- upload_video_url

- which_host

- recall_video

- add_mrss_feed

- get_mrss_feed_status

- Additional Inplay Info
- get_views

- get_viewed_minutes

- get_unique_viewers

- get_new_viewers

- get_video_list_analytics

- get_video_engagement

- get_player_embeds

- get_geo_analytics

- get_categories

- get_traffic_sources

- get_search_terms

- get_attention_span

- get_bandwidth_usage

- get_stream_rebuffers

- get_start_delays

- get_video_list_performance

- get_geo_performance

- get_os

- get_browser

- get_runtime

- get_demographics_age

- get_demographics_gender

- get_demographics_hh_income

- get_demographics_marital_status

- get_demographics_children

- get_demographics_homeowners

- get_trackers

- create_tracker

- update_tracker

- get_publishers

- share_inplay

- share_revoke

- share_list

- List of Video Sites
- PHP Reference Application
- Info For Partners
- Timezones
- Troubleshooting
upload_video
Upload a video file to a TubeMogul user's account.
Explorer
Request URL
http://api.tubemogul.com/api/v3/
HTTP method
POST
Special Requirements
The hash for this method is generated differently than the other methods. See Authenticating for details.
The hostname used for this call needs to be obtained by first calling which_host.
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.
token (string)- Required- This value is obtained by calling whichHost.
file (binary file)- Required- The file. (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 empty20: There must be two or more non-identical tags30: The category string is invalid40: File is too large50: File is a duplicate60: File extension is unsupported70: Invalid Upload Token80: Invalid campaign ID90: 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 = '';
#
# Both of these values are returned from a call to whichHost
#
$token = '';
$apihost = 'http://api-uploadXX.tubemogul.com';
#
# Just for this sample script, the file is hard-coded.
# It assumes the video is in the same directory as this file.
#
$file_name = '';
$file = dirname(__FILE__).'/'.$file_name;
#
# Required arguments
#
$method = 'uploadVideo';
$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 uploadVideo is special.
# Do NOT URL-encode any of these.
#
$hash_string = $secret_key.
$user_token.
$method.
$partner_id.
$now.
$title.
$file_name;
$hash = sha1($hash_string);
$poststring = array(
'date' => $now,
'userToken' => $user_token,
'partnerID' => $partner_id,
'token' => $token,
'title' => $title,
'tags' => $tags,
'description' => $description,
'category' => $category,
'file' => "@".$file,
'method' => $method,
'hash' => $hash,
);
echo http_build_query($poststring);
# using cURL so we can easily pass the file along.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apihost);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $poststring);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
echo '<br /><br />Result: '.htmlspecialchars($result);
?>