/ Programming

SakaiPy - The Sakai Python RESTful Interface

I'd like to introduct you to SakaiPy. SakaiPy is a python based RESTful interface to any Sakai Installation.

It gives you access to most of your information on the Sakai server you give it access to. These included, but aren't limited too, announcements, calendars, assignments and blog posts.

Over time this will grow to include every possible Sakai tool and to interface with other services such as Google Calendar and many others.

When you make a query, it'll return to you all of the data in a JSON format. I will add the functionality to get XML data in soon though. The code that is currently up is only a few lightweight versions of a few tools.

Once I finish a few more tools. I'll be able to write up better documentation for all of the tools.

You can check out some example code below!

Example Code:

# -*- coding: utf-8 -*-
from SakaiPy import RequestGenerator
from SakaiPy.SakaiTools import Calendar

"""Say I want to get a list of all of the Calendars I have for a specific site. I'll write all the code first then explain each part."""




rq = RequestGenerator.RequestGenerator(authInfo)

Calendars= Calendar.Calendar(rq).getAllMyEvents()
print Calendars["calendar_collection"]
  • authInfo is a dict containing the URL of the login page. This code will change to also take in the ID name of the login form.

  • Username is your username

  • Password is your password

  • RequestGenerator is the class that handles the authentication and REST requests.

  • You would then define an instance of the tool you wish to use and execute the query.

As of now, it returns to you the JSON representation of the data.

All of the documentation for the entire RESTful interface for Sakai can be found here

BTW: In no way,shape,form or Universe does Rutgers University endorse or have anything to do with this library. I made it myself.

SakaiPy - The Sakai Python RESTful Interface
Share this

Subscribe to Wills Thoughts