Create new channel

Started by Kevin on January 13th, 2010 05:27 | return to category | Follow by RSS

Can you show me a quick way to create a new channel using the api. I am comfortable with the api for the most part but I can't figure out how to create a new channel.

JeroenW

January 13th, 2010 11:02

Using the PHP API kit, you can do the following:

<?php
# Instantiate the PHP API Kit.
require_once('botr/api.php');
$botr_api = new BotrAPI('xxxx', 'yyyy');

# Create the (dynamic) channel.
$response = $botr_api->call('/channels/create',array('type'=>'dynamic'));
if($response['error']) { die($response); }
$channel_key = $response['channel']['key'];

# Set some channel properties.
$response = $botr_api->call('/channels/update',
  array('channel_key'=>$channel_key,'title'=>'Last 5','videos_max'=>5));
if($response['error']) { die($response); }

# Preview the channel.
echo "<a href='http://content.bitsontherun.com/previews/$channel_key-0ZDVNwjY'>Preview channel</a>";
?>

This creates a dynamic channel, which is easy because videos are automatically inserted. With manual channels, you should use the /channels/videos calls to add videos one by one.

Kevin

January 13th, 2010 17:44

Great, thanks!

The 2 separate api calls confused me when reading the documentation.

This is exactly what I needed.

Post your reply

Reply form You can use some Markdown formatting. captcha Answer this simple calculation, to show us you're human
Pay as you go

Pay as you go

No commits, no monthly fees. Only pay for what you use. Replenish your account

We are hiring

We are hiring

Looking to join a cutting edge online video company? Then send us your resume.

Sign up

Signup for free

No login yet? Then sign up now and start uploading and streaming video in minutes.