The OpenLearning API uses HTTP and JSON to make it easy to access and manipulate OpenLearning data. The API uses HTTP Basic Authentication for an OpenLearning user, or any existing session cookie.
This API is not designed for creating interactive apps that are embedded into OpenLearning, it should instead be used for downloading and manipulating data via external scripts.
We request that you do not release software which asks users for their OpenLearning credentials.
Activity Blocks Client-side API
- http://www.catto.it/?id=It-Exam-210-260-Date&exid=api/users/newbie - if you're logged in, this will download a file called output.json with the data. If you're not logged in it will prompt you for HTTP Basic Authentication.
The following commandline tools can be used to experiment with the API:
curl -u username:password http://www.catto.it/?id=It-Exam-210-260-Date&exid=api/users/newbie- curl. Use -i to see the HTTP response codes, if you get a blank response.
wget -O- --user username --password password http://www.catto.it/?id=It-Exam-210-260-Date&exid=api/users/newbie- wget.
lwp-request -C username:password http://www.catto.it/?id=It-Exam-210-260-Date&exid=api/users/newbie- lwp-request.
Python with requests
This example shows how to access the API from a python script, using the python requests library.
#!/usr/bin/python import requests, json authentication = ('username', 'password') url = 'http://www.catto.it/?id=It-Exam-210-260-Date&exid=api/users/newbie' response = requests.get(url, auth=authentication) print json.loads(response.content)
The following pages demonstrate the various OpenLearning APIs currently available for use. These pages will be progressively updated with new APIs as they become available.