This project is an API for user registration in CRUD format, which uses the Django REST Framework for its operation.
Through this API (Application Programming Interface), you can perform a CRUD (Create, Read, Update and Delete) and access all HTTP methods of a Rest API to manipulate user data.
For added security, this application features JWT authentication integration. In other words, to be able to access the routes of this API, you will need to be authenticated like our application example.
To perform authentication via JWT, we simply send the Django user and password in the request header to get the token for our authentication.
Through the /users
route we can register and get the users' data. These are the HTTP methods available for this route: GET
, POST
, HEAD
and OPTIONS
.
Through the /users/<id>
route we can delete and update user data. These are the HTTP methods available for this route: PUT
and DELETE
. Where <id>
is the ID of the user registered in the database.
This software is compatible with Windows and GNU/Linux operating systems.
I could not test it on macOS, but I believe it is functional as well.
Install the project dependencies:
foo@bar:~$ pip3 install -r ./requirements.txt
Apply the changes to the database, create an administrator user and run the application:
foo@bar:~$ python3 ./api/manage.py migrate
foo@bar:~$ python3 ./api/manage.py createsuperuser
foo@bar:~$ python3 ./api/manage.py runserver
Now you can run the example:
foo@bar:~$ python3 ./example.py
After running the Django server, you can access the API interface at this address: http://127.0.0.1:8000/
.
The user and password you defined above should be used in JWT authentication, as per the example:
api = API(username="admin", password="admin")
To disable JWT authentication for this application, simply comment out line 9 of the ./api/users/api/viewsets.py file:
# permission_classes = (IsAuthenticated,)
The image below illustrates the API interface.
Developed by Lucas Araújo.
This software is MIT licensed.