I have a problem with the Vimeo API, and the way that they show their documentation gave me a headache. Look, I need to make a request to the api to retrieve information of private videos. I have a code to do this, but with normal videos:
$.ajax({
type: 'GET',
url: 'https://vimeo.com/api/v2/video/' + x.val() + '.json',
jsonp: 'callback',
dataType: 'jsonp'
}).done(function(data){
$('#vimeo #nameVideo').attr('value', data[0].title);
$('#vimeo #descriptionVideo').attr('value', data[0].description);
});
And it works! So, the problem is: I don't know where, or how, put the Authentication info to access to the private videos. I created the app, and Vimeo gave the Client Identifier, Client Secrets and Acces Token with the scopes public and private.
I use vimeo API Playground to make test and this is what I want: Vimeo Playground Example
Thanks for all.
Well, after a good time of read and investigation, I have solved my problem. First, I found this: https://www.npmjs.com/package/vimeo Vimeo have a package of npm, so, the first think what we need to do is install it with
npm install vimeo
Then in the respective router controller, in my case videosdb.js, create de required variables
var Vimeo = require('vimeo').Vimeo;
//Put the data obtained when you create the app in developer.vimeo.com
var vimeoVids = new Vimeo('<Client Identifier>', '<Client Secret>', '<Access Token>');
And with that you can do whatever you want with the Vimeo Api. In my case, retrieve the info of the private videos of an especific user.
vimeoVids.request({
path: '/users/<User Name>/videos/<Video ID>'
}, function(e, data){
if(e){
console.log(e);
}
res.send(data);
})
})