Skip to content

Latest commit

 

History

History
89 lines (55 loc) · 3.2 KB

README.md

File metadata and controls

89 lines (55 loc) · 3.2 KB

Django REST Framework

This project is an API for user registration in CRUD format, which uses the Django REST Framework for its operation.

Badge Badge

Content

About

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.

Routes

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.

Support

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.

Running

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

Notes

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,)

Screenshot

The image below illustrates the API interface.

Author

Developed by Lucas Araújo.

License

This software is MIT licensed.