Skip to content

romanwixinger/profiles-rest-api

Repository files navigation

Profiles REST API

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.

Installation

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 migrate

Now you are ready to launch the local instance.

python manage.py runserver

Depending 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.

REST-API documentation

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.

  • UserProfile: POST and GET user profiles.

  • Login: POST the credentials and get an authorization token with the response.

  • Topic: POST and GET topics.

  • Subtopic: POST and GET subtopics.

  • Question: POST and GET questions.

  • Answer: POST, GET and PATCH answers.

  • Test: POST and GET tests.

  • RecommendedTest: GET and POST recommended tests.

  • CompletedTest: POST, GET and PATCH completed tests.

  • TheoryPage: POST and GET theory pages.

  • RecommendedTheoryPage: GET recommended theory pages.

About

Source code for the first learning tool backend

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors