Code for the first Nasci learning tool backend based on the Profiles REST API course code. A running instance of the REST API can be found here.
To run a local instance of the REST API you first install the requirements in your console.
pip install -r requirements.txt
Then you have to make the migrations with the following commands.
python manage.py makemigrations
python manage.py migrateNow you are ready to launch the local instance.
python manage.py runserverDepending on the configurations of your IDE you have to specify the host. Normally you get a message with this link to see the running instance.
To get access to the full capability of the REST API, you have to get an Authorization token with the following steps. Then open this link in the browser and navigate to the profile view. Create a user profile and navigate to the login view. Type in your credentials and get an authorization token. Add the ModHeader Chrome extension to Chrome and create a new header. Select Authorization and insert the token in the form token mymocktoken in the field. Activate the request header and you should have access to all the functionality.
To add learning materials to the REST API, you can use the Github repository romanwixinger/database-initializer or you create your own learning materials and send them with HTTP POST requests.
In the following, all possible requests to the API are listed with links to their documentation. The requests are grouped according to their underlying model and arranged after increasing complexity. Note that the views below are custom views which do not correspond directly to the views shown in here when opened in the browser. The custom views have an additional /custom- part in the url.
-
Login: POST the credentials and get an authorization token with the response.
-
Topic: POST and GET topics.
-
RecommendedTheoryPage: GET recommended theory pages.