0% found this document useful (0 votes)
5 views3 pages

SSDE Python API Assessment

The document outlines the creation of a RESTful API for a Task Manager application using FastAPI and PostgreSQL. It specifies mandatory requirements including CRUD functionality, input validation, error handling, and a Docker Compose setup. Additionally, it provides a data model for tasks and example endpoints for API interaction.

Uploaded by

Pankaj Dadwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

SSDE Python API Assessment

The document outlines the creation of a RESTful API for a Task Manager application using FastAPI and PostgreSQL. It specifies mandatory requirements including CRUD functionality, input validation, error handling, and a Docker Compose setup. Additionally, it provides a data model for tasks and example endpoints for API interaction.

Uploaded by

Pankaj Dadwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Python API Assessment

Objective:
Create a RESTful API for managing a basic "Task Manager" application. The API
will allow users to perform CRUD (Create, Read, Update, Delete) operations on
tasks using FastAPI and PostgreSQL.
Note: Use of ChatGPT or any AI assistance in building the application is
strictly prohibited.

Requirements
Tech Stack (Mandatory):
 FastAPI for API development.
 PostgreSQL as the database.
 Docker Compose for container orchestration.
 SQLAlchemy or equivalent ORM for database interaction.

Tasks Data Model:


Each task must include the following attributes:
 id (integer): Unique identifier for the task (Auto-incremented).
 title (string): Title of the task.
 description (string): Description of the task.
 completed (boolean): Status of the task (default is false).

Functional Requirements:
 Implement full CRUD functionality for tasks.
 Input validation (e.g., title and description must not be empty).
 Error handling (e.g., task not found, invalid input, etc.).

Additional Requirements:
 Use PostgreSQL as the database backend (no in-memory or file-based
DBs).
 Provide a Docker Compose setup to run both the FastAPI app and the
PostgreSQL database.
 All configuration should be set via environment variables (e.g., DB URL).
 Database schema initialization (e.g., migrations or SQL scripts) must be
included.
 Endpoints should follow RESTful principles.

Expected Deliverables:
 A complete FastAPI project directory structure (not a single script).
 A docker-compose.yml file to spin up the API and database.
 Instructions in a README.md on how to:
o Build and run the application using Docker Compose.

o Interact with the API using tools like curl or Postman.

Example Endpoints:
POST /tasks
Request:
{
"title": "Complete Python Assessment",
"description": "Implement a REST API for task management."
}
Response:
{
"id": 1,
"title": "Complete Python Assessment",
"description": "Implement a REST API for task management.",
"completed": false
}

GET /tasks
Response:
[
{
"id": 1,
"title": "Complete Python Assessment",
"description": "Implement a REST API for task management.",
"completed": false
}
]

GET /tasks/99 (Non-existent ID)


Response:
{
"error": "Task not found"
}

You might also like