Todolist API

Create a simple todo Rest API with features to add, complete, and delete tasks.

1 hour
easy
68 submissions

Project Overview

Create a simple todo Rest API with features to add, complete, and delete tasks.

The TodoList API Project is a comprehensive, hands-on API development and testing project. This project involves building a RESTful API that handles basic task management operations for a to-do list application. Through implementing this API, developers will learn how to design, implement, and test various endpoints to manage tasks effectively.

Your submissions

No submissions yet, start by making your first submission

Detailed Project Description

In this project, you'll create an API that supports core CRUD (Create, Read, Update, Delete) operations, along with robust edge case handling. The API provides endpoints to:

  • Create tasks with titles and descriptions
  • Retrieve tasks by ID to view task details
  • Update tasks with new information or completion status
  • Delete tasks and confirm their removal from the list

Key Test Suites

1. CRUD Operations Suite

This suite tests core functionality for managing tasks within the to-do list, ensuring that all CRUD operations behave as expected:

  • Create a new task: Verifies task creation, expecting fields like id, title, description, and completed in the response.
  • Retrieve a task by ID: Confirms that tasks can be accurately retrieved after creation.
  • Update a task: Tests updating a task’s information and ensures the updated values reflect correctly.
  • Delete a task and confirm deletion: Ensures a task can be deleted and verifies it no longer exists.

2. Edge Cases Suite

This suite challenges the API with uncommon scenarios to validate stability and error handling:

  • Create a task with an empty title: Attempts to create a task without a title to ensure that proper validation prevents it, expecting an appropriate error message.

API Specification

You api should respect this openapi specification:

openapi: 3.0.0 info: title: Task Management API description: An API for managing tasks with CRUD operations. version: 1.0.0 paths: /tasks: post: summary: Create a Task description: Creates a new task with a unique identifier. requestBody: required: true content: application/json: schema: type: object required: - title properties: title: type: string description: The title of the task. description: type: string description: Optional description of the task. responses: '201': description: Task created successfully. content: application/json: schema: $ref: '#/components/schemas/Task' '400': description: Validation error content: application/json: schema: $ref: '#/components/schemas/ValidationError' get: summary: Retrieve All Tasks description: Retrieves a list of all tasks. responses: '200': description: A list of tasks. content: application/json: schema: type: array items: $ref: '#/components/schemas/Task' /tasks/{id}: get: summary: Retrieve Task by ID description: Retrieves a specific task based on its unique identifier. parameters: - name: id in: path required: true schema: type: integer responses: '200': description: Task found and returned. content: application/json: schema: $ref: '#/components/schemas/Task' '404': description: Task not found. content: application/json: schema: $ref: '#/components/schemas/Error' put: summary: Update Task (Full Update) description: Fully updates an existing task by replacing all fields with the provided data. parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: type: object properties: title: type: string description: New title of the task. description: type: string description: New description of the task. completed: type: boolean description: Completion status of the task. responses: '200': description: Task updated successfully. content: application/json: schema: $ref: '#/components/schemas/Task' '404': description: Task not found. content: application/json: schema: $ref: '#/components/schemas/Error' delete: summary: Delete Task description: Deletes a task identified by its unique identifier. parameters: - name: id in: path required: true schema: type: integer responses: '204': description: Task deleted successfully. No content returned. '404': description: Task not found. content: application/json: schema: $ref: '#/components/schemas/Error' components: schemas: Task: type: object properties: id: type: integer description: Unique identifier of the task. title: type: string description: Title of the task. description: type: string description: Description of the task. completed: type: boolean description: Completion status of the task. ValidationError: type: object properties: errors: type: array items: type: object properties: msg: type: string param: type: string location: type: string Error: type: object properties: error: type: string description: Error message

Objectives

  • Develop a RESTful API that meets standardized CRUD requirements.
  • Validate responses and error handling for each operation, ensuring reliability under standard and edge case scenarios.
  • Implement structured testing for real-world scenarios, covering essential validation cases for robust API design.

Outcome

By completing the TodoList API Project, you will gain practical experience in API development, testing strategies, and handling common edge cases. This project is ideal for developers looking to strengthen their skills in backend development, API design, and automated testing.

Project Completion Criteria

  • Create a new task: Verifies task creation, expecting fields like `id`, `title`, `description`, and `completed` in the response.
  • Retrieve a task by ID: Confirms that tasks can be accurately retrieved after creation.
  • Update a task: Tests updating a task’s information and ensures the updated values reflect correctly.
  • Delete a task and confirm deletion: Ensures a task can be deleted and verifies it no longer exists.
  • Create a task with an empty title: Attempts to create a task without a title to ensure that proper validation prevents it, expecting an appropriate error message.