Welcome to the Task Management API. This API is designed to help users manage tasks, categories, and user accounts efficiently. It allows you to perform operations such as creating, updating, retrieving, and deleting tasks and categories, with secure authentication. This README provides an overview of the API endpoints and how to interact with the system.
- Introduction
- Base URL
- Authentication
- User Endpoints
- Task Management Endpoints
- Category Management Endpoints
- Contributing
- License
The Task Management API enables users to manage their tasks and categories in a simple, efficient way. It is ideal for managing daily activities and personal projects, providing easy access to track and update tasks.
This documentation provides detailed information on how to interact with the API. Each section includes the relevant endpoints, HTTP methods, request bodies, and example responses.
The base URL for accessing the API is:
http://127.0.0.1:8000/api/
All API requests must start with this base URL, followed by the appropriate endpoint.
This API uses token-based authentication. Users must log in to obtain a token, which should be included in the Authorization header of all subsequent requests.
To log in, send a POST request with your username and password:
Endpoint: /accounts/login/
Method: POST
Request Body:
{
"username": "new_user",
"password": "asdasdasd"
}Response:
{
"token": "your_token_here"
}This will return a token that must be included in the Authorization header of future requests. For example:
Authorization: Token your_token_here
To create a new user, send a POST request with the required fields:
Endpoint: /accounts/register/
Method: POST
Request Body:
{
"username": "new_user",
"email": "user@example.com",
"password": "your_password"
}Response:
{
"id": 1,
"username": "new_user",
"email": "user@example.com"
}To log out, send a POST request with the token in the header:
Endpoint: /accounts/logout/
Method: POST
Headers:
Authorization: Token your_token_here
Response: 204 No Content
To request a password reset, send a POST request with your email:
Endpoint: /accounts/password-reset/
Method: POST
Request Body:
{
"email": "user@example.com"
}Response:
{
"message": "If an account with that email exists, a password reset link has been sent."
}To confirm the password reset, send a POST request with the necessary parameters:
Endpoint: /accounts/password-reset-confirm/
Method: POST
Request Body:
{
"Uidb64": "NQ",
"Token": "a9cb04b669f5d9025ba5e33db56c6516cb177964",
"new_password": "87654321"
}Response:
{
"message": "Password has been reset."
}To retrieve all tasks associated with the logged-in user, send a GET request:
Endpoint: /tasks/list/
Method: GET
Headers:
Authorization: Token your_token_here
Response:
[
{
"id": 12,
"title": "Complete project",
"description": "Finalize and submit the project.",
"due_date": "2025-01-15T12:00:00Z",
"priority": "High",
"status": "Pending",
"completed_at": null,
"user": 14,
"category": null
}
]To create a new task, send a POST request with the necessary details:
Endpoint: /tasks/create/
Method: POST
Headers:
Authorization: Token your_token_here
Request Body:
{
"user": 2,
"title": "Complete project",
"description": "Finalize and submit the project.",
"due_date": "2025-01-15T12:00:00Z",
"priority": "High",
"status": "Pending"
}Response:
{
"id": 11,
"title": "Complete project",
"description": "Finalize and submit the project.",
"due_date": "2025-01-15T12:00:00Z",
"priority": "High",
"status": "Pending",
"completed_at": null,
"user": 5,
"category": null
}To retrieve a specific task, send a GET request with the task's ID:
Endpoint: /tasks/{id}/
Method: GET
Headers:
Authorization: Token your_token_here
Response:
{
"id": 11,
"title": "Complete project",
"description": "Finalize and submit the project.",
"due_date": "2025-01-15T12:00:00Z",
"priority": "High",
"status": "Pending",
"completed_at": null,
"user": 5,
"category": null
}To update an existing task, send a PUT request with the updated details:
Endpoint: /tasks/{id}/
Method: PUT
Headers:
Authorization: Token your_token_here
Request Body:
{
"title": "Updated Task",
"description": "Updated description",
"due_date": "2025-10-11T00:00:00Z",
"priority": "Low",
"status": "Pending",
"category": null,
"recurrence": "None"
}Response:
{
"id": 1,
"title": "Updated Task",
"description": "Updated description",
"due_date": "2024-10-01T00:00:00Z",
"priority": "Low",
"status": "Pending",
"category": null,
"recurrence": "None"
}To delete a specific task, send a DELETE request:
Endpoint: /tasks/{id}/
Method: DELETE
Headers:
Authorization: Token your_token_here
Response: 204 No Content
To retrieve all categories, send a GET request:
Endpoint: /categories/list/
Method: GET
Headers:
Authorization: Token your_token_here
Response:
[
{
"id": 5,
"name": "Electronics"
}
]To create a new category, send a POST request:
Endpoint: /categories/create/
Method: POST
Headers:
Authorization: Token your_token_here
Request Body:
{
"name": "Electronics"
}Response:
{
"id": 5,
"name": "Electronics"
}To retrieve a specific category, send a GET request with the category's ID:
Endpoint: /categories/{id}/
Method: GET
This API provides an efficient way to manage tasks and categories, supporting a variety of operations for users and administrators. It uses token-based authentication to secure access and provide a seamless user experience.