jsPlatform API
This is a simple wrapper for NodeJS around the jsPlatform API
to make api calls easier.
Installation
npm install jwplatform-api
Usage
Creating a new jwPlatform API object:
var jwPlatform = require('jwplatform-api');
var api = new jwPlatform({
key: '...',
secret: '...'
});
var logger = {
debug: function() {},
error: function() {}
};
var api = new jwPlatform({ ... }, logger);
var api = new jwPlatform({ ... }, function() {});
Make arbitrary queries:
api.get('v1/videos/show', { video_key: 'some_key' }, null, function(err, result) {
});
var template = {
name: 'Test template',
format_key: 'ogg',
default: 'none'
};
api.post('v1/templates/create', null, template, function(err, result) {
});
There are a few shortcuts for common api calls:
Generating an upload URL
api.getUploadUrl('v1', function(err, result) {
});
Getting information about a video (conversions/list wrapper)
api.getVideoData('v1', '<your video key>', function(err, result) {
});
Template stuff
var template = {
name: 'the name',
format_key: 'ogg',
default: 'none'
};
api.createTemplate('v1', template, function(err, result) { });
var fields = {
template_key: '...',
name: 'the new name'
};
api.updateTemplate('v1', fields, function(err, result) { });
api.getTemplates('v1', function(err, result) { });