I am working on a react web application that can upload videos to Vimeo and retrieve them when required. I am able to successfully upload the video privately. I am using the hide from Vimeo privacy setting and embed on specific domains option. On uploading the video I want to receive an embeddable iframe string from the backend server so that I can display the video in my react app.
The oEmbed API provided on Vimeo API reference page is working in postman. But when I try to get it through nodejs string I get the following error:
Error: {“error”:”The requested page couldn’t be found.”}
at IncomingMessage. (C:Usersprithnode_modulesvimeolibvimeo.js:164:19)
at IncomingMessage.emit (node:events:402:35)
at endReadableNT (node:internal/streams/readable:1343:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
status code
404
headers
{
connection: ‘close’,
‘content-length’: ’49’,
server: ‘nginx’,
‘content-type’: ‘application/vnd.vimeo.error+json’,
expires: ‘Sun, 10 Apr 2022 20:00:04 GMT’,
‘cache-control’: ‘private, no-store, no-cache’,
‘strict-transport-security’: ‘max-age=31536000; includeSubDomains; preload’,
‘request-hash’: ‘8fa895fc’,
‘x-bapp-server’: ‘api-v22576-6dhrr’,
‘x-vimeo-dc’: ‘ge’,
‘accept-ranges’: ‘bytes’,
via: ‘1.1 varnish, 1.1 varnish’,
‘fastly-original-body-size’: ‘0’,
date: ‘Mon, 11 Apr 2022 08:00:04 GMT’,
‘x-served-by’: ‘cache-iad-kiad7000087-IAD, cache-maa10229-MAA’,
‘x-cache’: ‘MISS, MISS’,
‘x-cache-hits’: ‘0, 0’,
‘x-timer’: ‘S1649664004.146166,VS0,VE292’,
vary: ‘Accept,Vimeo-Client-Id’
}
This is my code:
vimeo_embed.js
let Vimeo = require('vimeo').Vimeo;
const USER_ID = "USER_ID"
const USER_SECRET = "USER_SECRET"
const USER_TOKEN = "USER_TOKEN"
let client = new Vimeo(USER_ID, USER_SECRET, USER_TOKEN);
client.request({
method: 'GET',
path: '/app/oembed.json/',
query: {url: 'https%3A//vimeo.com/xxxxxxxx'}
},function (error, body, status_code, headers) {
if (error) {
console.log('error');
console.log(error);
} else {
console.log('body');
console.log(body);
}
console.log('status code');
console.log(status_code);
console.log('headers');
console.log(headers);
});
I am not clear about why this error is thrown. I have verified that the authentiction is working.
Please help me.