A basic To-Do list API using Django and Django Rest Framework (DRF).
- Python 3.x
- Django
- Django Rest Framework
Clone the repository to your local machine using the following command:
git clone https://github.com/Ankit-ICY/TASK.git
cd todo-list-apiCreate a virtual environment to install dependencies in an isolated environment:
CREATE : python -m venv venv
ACTIVATE : venv\Scripts\activate
Install the required dependencies using pip:
pip install -r requirements.txt
Apply the database migrations to set up your database schema:
python manage.py makemigrations
python manage.py migrate
Start the Django development server: python manage.py runserver
Here are the endpoints provided by the API:
- Create Task: POST /api/tasks/
- Retrieve Task List: GET /api/tasks/
- Retrieve Single Task: GET /api/tasks//
- date Task: PUT/PATCH /api/tasks//
- Delete Task: DELETE /api/tasks//
- Tasks Due Today: GET /api/tasks/due-today/
Title: Ensure the title is not empty. Due Date: If provided, the due date should be a future date.
##Example Requests
POST /api/tasks/
Content-Type: application/json
{
"title": "Test Task",
"description": "This is a test task.",
"completed": false,
"due_date": "2024-12-31"
}
GET /api/tasks/
GET /api/tasks/1/
PUT /api/tasks/1/
Content-Type: application/json
{
"title": "Updated Task",
"description": "This is an updated test task.",
"completed": true,
"due_date": "2024-01-01"
}
DELETE /api/tasks/1/