Problem statement:
Create an application where users can create tasks, view them, mark them as completed and delete them. Create REST APIs alone. No need to develop the front-end.
Users should be able to do the following.
- Signup using email and password
- Create tasks
- View all tasks
- Mark a task as completed
- Delete tasks
- Login & logout
Use the following tools/frameworks:
- Django (DRF is optional)
- Django ORM
- Sqlite
- Git
Solution:
Home page
Go to Any of the Api
Sign up using Api
Enter an Email & Password (as payload) to create a user
{
"email": "kbr@csegeeks.com",
"password": "kabir12345"
}
After Sending post request, It tells User created
Login
Enter Email & Password to Login
{
"email": "kbr@csegeeks.com",
"password": "kabir12345"
}
it than Tells that User is logged-In
Create Task
Create a Task by providing
{
"task": "Complete a Django book",
"description": "Complete Back and Return back"
}
Created Task is then Displayed
View All Tasks
Here You can view all the tasks of that Particular user (logged-in User)
View a Particular Task:
To make less apis & get things done efficiently, I used payload for partular task to delete or mark a task as complete.
Mark task Complete
{
"option": "mark"
}
OR
{
"option": "complete"
}
Use Above json as payload
It will Mark the Task Complete
Can Be seen at All Tasks as well
Delete Task
{
"option": "del"
}
OR
{
"option": "delete"
}
Use above json as Payload
It will Delete the Particular Task
All Tasks list for logged-in User
Logout
Got to login api & send a Empty Post payload or write logout
This will Log you out
Note
Onces you have logged out, You can not access API’s to create or view tasks