Brightcove axios
An axios wrapper for Brightcove APIs
Installing
$ npm install brightcove-axios
Usage
const { cmsApi } = require('brightcove-axios');
const bcRequestConfig = {
clientId: 'aaaaa-bbbbb-ccccc-dddd-eeeeee',
clientSecret: 'EXuoOigTEXfpd4iCJaaaFWKPreWjojtX7kQwG4Ne8QuBACaS37Hu0v8TpqEmYtLBLloSnegqtWJbC7dFj9RaHw',
};
const accountId = '5132399229001';
cmsApi.get(`/accounts/${accountId}/videos`, bcRequestConfig)
.then(response => console.log('CMS API response', response))
.catch(err => console.error('CMS API err', err));
Available APIs
CMS API
const { cmsApi } = require('brightcove-axios');
const bcRequestConfig = {
clientId: 'aaaaa-bbbbb-ccccc-dddd-eeeeee',
clientSecret: 'EXuoOigTEXfpd4iCJaaaFWKPreWjojtX7kQwG4Ne8QuBACaS37Hu0v8TpqEmYtLBLloSnegqtWJbC7dFj9RaHw',
};
const accountId = '5132399229001';
cmsApi.get(`/accounts/${accountId}/videos`, bcRequestConfig)
.then(response => console.log('CMS API response', response))
.catch(err => console.error('CMS API err', err));
Dynamic Ingest API
const { dynamicIngestApi } = require('brightcove-axios');
const bcRequestConfig = {
clientId: 'aaaaa-bbbbb-ccccc-dddd-eeeeee',
clientSecret: 'EXuoOigTEXfpd4iCJaaaFWKPreWjojtX7kQwG4Ne8QuBACaS37Hu0v8TpqEmYtLBLloSnegqtWJbC7dFj9RaHw',
};
const accountId = '5132399229001';
const postData = {
master: {
url: "http://learning-services-media.brightcove.com/videos/mp4/greatblueheron.mp4",
audio_tracks: [
{ language: "en", variant: "main" },
]
},
};
dynamicIngestApi.post(`/accounts/${accountId}/videos/${videoId}/ingest-requests`, postData, bcRequestConfig)
.then(response => console.log('Dynamic Ingest API response', response))
.catch(err => console.error('Dynamic Ingest API err', err));