Task Manager API is a RESTful API developed with Spring Boot for managing tasks and task categories. The API allows the creation, retrieval, updating, and deletion of tasks and categories using a MySQL database.
- Java 17+
- Maven 3+
- MySQL 8+
Create the database in MySQL:
CREATE DATABASE taskdb;Configure the src/main/resources/application.properties file with your MySQL credentials:
spring.datasource.url=jdbc:mysql://localhost:3306/taskdb?serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=1234
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=trueReplace root and 1234 with your database credentials.
git clone this repository
cd task-manager-api
mvn clean install
mvn spring-boot:runThe API will be available at http://localhost:8080/.
- URL:
POST /tasks - Request JSON:
{
"title": "Complete documentation",
"description": "Review and correct project documentation",
"status": "PENDING",
"categoryId": 1
}- Response (200 OK):
{
"id": 1,
"title": "Complete documentation",
"description": "Review and correct project documentation",
"status": "PENDING",
"categoryId": 1
}- URL:
GET /tasks - Response:
[
{
"id": 1,
"title": "Complete documentation",
"description": "Review and correct project documentation",
"status": "PENDING",
"categoryId": 1
}
]- URL:
GET /tasks/{id} - Response:
{
"id": 1,
"title": "Complete documentation",
"description": "Review and correct project documentation",
"status": "PENDING",
"categoryId": 1
}- URL:
PUT /tasks/{id} - Request JSON:
{
"title": "Review documentation",
"description": "Update outdated information",
"status": "IN_PROGRESS",
"categoryId": 1
}- URL:
PUT /tasks/{id}/status?status=COMPLETED - Response:
{
"id": 1,
"title": "Review documentation",
"description": "Update outdated information",
"status": "COMPLETED",
"categoryId": 1
}- URL:
DELETE /tasks/{id} - Response:
{
"message": "Task with ID 1 has been successfully deleted."
}- URL:
POST /tasks/categories - Request JSON:
{
"name": "Work"
}- Response:
{
"message": "Category created successfully.",
"id": "1"
}- URL:
GET /tasks/categories - Response:
[
{
"id": 1,
"name": "Work"
}
]- URL:
GET /tasks/categories/{id} - Response:
{
"id": 1,
"name": "Work"
}- URL:
PUT /tasks/categories/{id} - Request JSON:
{
"name": "Business"
}- URL:
DELETE /tasks/categories/{id} - Response:
{
"message": "Category with ID 1 has been successfully deleted."
}