- User Profile Login/Register and status update Rest API using Django Rest Framework
- Using SQLite as the database
- python3
- pip
- python libraries: _ Django _ Django Rest Framework
- git
-
Type the following in your terminal
git clone https://github.com/pushp1997/profiles-rest-api.git
-
Change the directory into the repository
cd ./profiles-rest-api
-
Create python virtual environment
python3 -m venv ./drf-env
-
Activate the virtual environment created
- On linux / MacOS :
source ./drf-env/bin/activate
- On Windows (cmd) :
"./drf-env/Scripts/activate.bat"
- On Windows (powershell) :
"./drf-env/Scripts/activate.ps1"
- On linux / MacOS :
-
Install python requirements
pip install -r requirements.txt
-
Run Server
python manage.py runserver 0.0.0.0:8000
-
/api/hello-view/ (using APIView)
- GET:
Little description about APIView
- PUT:
{ "name" : "Enter your name here" }
-
/api/hello-viewset/ (using ViewSet)
- GET:
Little description about ViewSet
- PUT:
{ "name" : "Enter your name here" }
-
/api/profile/ (using ViewSet)
- GET:
List of all User Profiles
- PUT:
{ "email": "", "name": "", "password": "" }
-
/api/profile/{primary_key}/
- GET:
Get the user profile with matching primary key
- POST:
Users can update their own profile only. In header provide 'Authorization' as key and 'Token {Authentication token}' as the value { "email": "", "name": "", "password": "" }
- PATCH:
Users can partialy update their own profile only. In header provide 'Authorization' as key and 'Token {Authentication token}' as the value { "email": "", "name": "", "password": "" }
- DELETE:
Users can delete their own profile only. In header provide 'Authorization' as key and 'Token {Authentication token}' as the value
-
/api/login/
- PUT:
{ "username": "Email address goes here", "password": "Password goes here" } On success the response will have authorization token