Get URL/Embed code to private Vimeo videos programatically

Albert picture Albert · Dec 19, 2014 · Viewed 33.6k times · Source

We've been long time users of Vimeo PRO, we use it to host our videos that are shown in multiple websites. Those videos are set to private, so they can't be found in the public part of Vimeo. Until now, whenever we needed to show a video, we would either get the embed code from Vimeo or copy the "direct link" (i.e. http://player.vimeo.com/external/1234567890.hd.mp4?s=nskljdfnsdlkn3498hnc3h49fo83h4oif3) to the video file of the desired quality and load it on a third party player. No issues at all doing all this.

Now we're going to start handling a lot more videos, so I've been looking at a way of automatizing the process of obtaining those embed codes or direct links. Looks like the way to go is by using the Vimeo API.

However, I've started looking into it and I'm pretty confused. It talks about registering apps, give users permissions when they request access, and other things that seem an overkill for what I really need.

We have no apps to register or multiple users to grant access, we just have our Vimeo username/password and the idea is to code a function that can be used in different websites to request a video URL or its embed code based on its Vimeo ID.

Am I looking in the wrong place? If not, what "app" should I register? Every single website that's going to use a video from Vimeo? (we have dozens)

If the Vimeo API is the only way to go, could someone link to an example as simple as possible for the kind of usage we need?

Thanks!

Answer

Dashron picture Dashron · Jan 2, 2015

The Vimeo API is the right system to use, and I'll describe briefly what will work best for your described workflow.

  1. Register an API app on https://developer.vimeo.com/apps

This is necessary for every API app. We need to know who is using our system, and how to contact them if necessary.

  1. Generate an access token.

There is general documentation at https://developer.vimeo.com/api/authentication, but you will likely be using the "single user application" workflow. It's a lofty title for "generate an access token via the UI on your application page, then hard code it into your app". This access token will interact with the API on behalf of the user who registered the application.

  1. Request your video information.

There are many different API calls to get video information. You can find these at https://developer.vimeo.com/api/endpoints. /me/videos will show all of the authenticated users videos, /videos/{video_id} will show a single video.