md0049252

Blackboard REST for Humans

Blog Post created by md0049252 on Sep 17, 2018

Overview:

I wrote a python library that makes consuming Blackboard REST really easy. It's very alpha, but I'm going to work on creating a three part series for the community and this is part 0.  Here's the easiest way to get started, though this does assume you have Python installed already.  Feel free to use virtual environments, I'm skipping them in this post.

 

pip install bbrest
pip install jupyterlab 
jupyter lab

 

bbrest is my library.

jupyterlab is an interactive REPL library that is mainly used for data science, but works well for our purposes.

Running 'jupyter lab' launches an interactive command line at http://localhost:8888/lab

Click the Python 3 icon to launch a Jupyter Notebook and then run the following commands:

from bbrest.bbrest import BbRest
url, key, secret = "your_url", "your_key", "your_secret"
bb = BbRest(url=url, key=key, secret=secret)

 

You now have a bb connection, which will do the following for you:

1. Get your version of Bb and only expose the REST calls you have access to.

2. Keep your session alive, automatically renewing if it expires.

3. Make some APIs way easier to use.

 

Here are some quick examples, for more, visit GitHub - mdeakyne/BbRest: Blackboard REST APIs... for humans?

#Session management
bb.expiration() #will print a human readable expiration time.
bb.calls_remaining() #will print your total calls, and call limit.

#Help with APIS
bb.User<tab> #will list calls with user
bb.GetUser(<tab>) #will list required parameters (userId=)
help(bb.GetUser) #will list documentation from Blackboard Explore APIs

#Convenience
bb.GetUser(userId='test_user') #will default to userName for users
bb.GetCourse(courseId='ENG-202') #will default to courseId for courses

bb.GetUser(userId='externalId:202020') #Can still use other specifications with : 

 

Currently, documentation is a little sparse, but you can get up and running in Python with 3 lines of code!

Here's a quick preview of the upcoming 3 part series:

 

1. REST Scripting in Python with Jupyter Lab. (Full REST setup guide)

2. REST App in Python in Flask.

3. LTI in your Flask, restricting access.

 

Hopefully, this library helps you out.  I'm happy to take feedback.

-Matt

Outcomes