cw31362

I've built a Node.js module for the REST APIs

Discussion created by cw31362 on Sep 15, 2017
Latest reply on Oct 19, 2017 by metro

On a whim today, I decided to build a Node.js module to make interacting with the REST APIs a lot easier. While it's far from complete, the basic functionality is there and published on npm for general use. It should only be used in application code (since it requires the key and secret to work).

 

Would anybody using Node.js care to do some testing and let me know how it goes?

 

A few things on my to-do list:

  • only request a new accessToken if the old one is rejected done!
  • test all the APIs

 

NPM: bb-rest

GITHUB: GitHub - C-Weinstein/bb-rest

 

Example:

 

const {restApp} = require('bb-rest');

//setup  

var origin = 'https://example.blackboard.com';
var key = 'myAppKey';
var secret = 'myAppSecret';

var myApp = new restApp(origin, key, secret);

//update the course with ID "myCourse" to have the name "New Name"

myApp.patch('courses/courseId:myCourse', {
  data: {name: 'New Name', description: 'This course has been renamed.'},
  complete: function (error, response, body) {
    console.log('error:', error);
    console.log('statusCode:', response && response.statusCode);
    console.log('body:', body);
  }
});

Outcomes