Task Assigment
Create an API with Login and Register functionality.
- You must ask additional personal information while registration. Additional fields must contain at least following: First Name, Last Name, Phone Number and profile photo.
- All fields must have back-end validation.
- Front-end is not a requirement for this app., you can use postman to test your API.
Solution
Download the Assignment Folder
-
First of all you need to download the folder using Download link <== CyberNX Assignment Folder
-
This will take you to a Web page where Your download will Get started Automatically
-
Save Zip file to your Required folder and Then Extract it as Well.
-
After Extracting you will see A Readme.md File and a Sub directory with project Name
-
Open this project folder (Dj_Auth).
Setting Up the server
-
Open it in a Terminal or vs code and open terminal there
-
Run the following command ` python manage.py runserver `
- And open the following link in your browser ` http://127.0.0.1:8000/ `
Task Completed - Created 2 APis
1. Login
Here you can login and logout
- to Login
Construct a json post with data as
{
"username":"kabir",
"password":"pass"
}
-
Response
- to Logout Send an Empty Request
- Response
2. Register
- ON GET Request
Shows all the registered accounts so far !
- On POST Request
Construct a json post with data as
{
"username":"kabir",
"password":"pass",
"first name":"kabir",
"last name":"Sharma",
"phone number":"8528425675",
"profile pic": ""
}
- Response
A Default user with default profile pic is created (Bcoz No profile was mentioned)
Here you need to upload profile pic using Pillow in Django so If you can send pic in request, It will put it as profile pic!