Search code examples
phpapivimeochannel

Vimeo PHP API How do I add my recently Uploaded Video to a Channel?


I finally got my batch Uploader to work and it is fast and efficient. I am also able to update the Name & Description metadata within the uploader script.

I can't find anywhere in the documentation where it even shows how to set the name & description text (I got that code from stackoverflow and it works). How can I get list of all possible supported parameter values and syntax for $lib->request and can this method be used to add a video by id to a channel name? Here is what I've tried but still can't assign video to channel.

<?PHP
$lib->request($uri, array('name' => 'This is the Title text for my video'), 'PATCH'); // This works perfectly
$lib->request($uri, array('description' => 'This is the description for my video'), 'PATCH'); // This works perfectly
$lib->request($uri, array('channels' => 'This is the name of a channel'), 'POST'); // This does not work but no errors
?>

Solution

  • Editing a video is a PATCH request to /videos/{video_id} (aka the video's URI). You can read more about that endpoint here: https://developer.vimeo.com/api/endpoints/videos#PATCH/videos/%7Bvideo_id%7D. You don't need to make a new request for every parameter, so request 1 and 2 can be merged together.

    To add a video to a channel, check out this endpoint: https://developer.vimeo.com/api/endpoints/channels#PUT%2Fchannels%2F%7Bchannel_id%7D%2Fvideos%2F%7Bvideo_id%7D. The basic idea is you merge the channel URI (/channels/{channel_id}) with the video uri (/videos/{video_id}) and make a PUT request to that url.

    For example:

    PUT /channels/12445/videos/612342