6. REST API¶
This guide is oriented towards a Quizzera running on
If working with the production server, or with a local version running on
a separate port, use the URL of that server instead of
You must have Quizzera up and running. Ensure that the WSSE (authentication protocol) migrations are made (if you have not done so already):
$ vagrant ssh $ django $ python manage.py makemigrations wsse $ python manage.py migrate
Now, get your API key by navigating to the API key listing: http://localhost:8000/api/keys/.
Authentication is done with the WSSE protocol.
The server WSSE settings are:
|Timestamp Format||ISO 8601|
You don’t need to worry about these settings if you are using the
For example, to send a request using
import requests from wsse.client.requests.auth import WSSEAuth auth = WSSEAuth('username', 'secret_key') resp = requests.get('http://localhost:8000/api/v1/', auth = auth)
Requests use different HTTP verbs to specify the action to perform. In addition, all requests operate on resources in the database (unless specified otherwise).
The resources available are:
The following operations are supported on the resource
|note:||The base for each URL is
|Create new object||
|List all objects||
|Get one object||
The data format of
PUT can be found by looking at the data
serializers. Similarly, the output format of
GET is also located there.
For example, to get a list of all courses, make a
GET request to
/api/v1/courses/. To view the information for course 2, make a
Permissions are defined per-model. They are listed below.
|Course||Create||Course administrator of any course|
|Question Attempt||Create||Enrolled user|
|Read||Owner of attempt, course administrator|
|Read||User who was granted extension, course administrator|
|Update||Course administrator that granted extension|
|Delete||Course administrator that granted extension|
|Read||Course administrator of any course|