PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/System Design/Credit Genie

Implement FastAPI CRUD endpoints from skeletons

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's ability to implement RESTful CRUD endpoints with FastAPI, focusing on API contract consistency, HTTP status codes and idempotency, input validation and exception handling, and unit testing.

  • medium
  • Credit Genie
  • System Design
  • Software Engineer

Implement FastAPI CRUD endpoints from skeletons

Company: Credit Genie

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Technical Screen

Given a FastAPI project with two working endpoint functions (create and read) and shared Pydantic models, implement the remaining update and delete endpoints to complete CRUD. Requirements: a) match the existing request/response schemas and status codes; b) preserve idempotency and return 404 vs 204 appropriately; c) validate inputs and handle exceptions; d) write unit tests for all four endpoints; e) explain how you would approach this if you have never used FastAPI before, by leveraging the existing endpoints as templates and the framework documentation.

Quick Answer: This question evaluates a candidate's ability to implement RESTful CRUD endpoints with FastAPI, focusing on API contract consistency, HTTP status codes and idempotency, input validation and exception handling, and unit testing.

Credit Genie logo
Credit Genie
Sep 6, 2025, 12:00 AM
Software Engineer
Technical Screen
System Design
6
0

Implement Update and Delete Endpoints in a FastAPI CRUD Service

Context

You are given a FastAPI project that already has working Create and Read endpoints and shared Pydantic models for request/response. Extend the service to complete CRUD by adding Update and Delete endpoints that are consistent with the existing code style and API contracts.

Assumptions (adjust to match the actual project):

  • The resource is an "Item" stored in memory or a repository abstraction.
  • Existing endpoints follow typical REST conventions:
    • POST /items → 201 Created with response body of the created item.
    • GET /items/{item_id} → 200 OK with item body, or 404 if not found.
  • The same Pydantic models are reused across endpoints (e.g., ItemCreate, ItemUpdate, ItemRead).

Requirements

  1. Implement Update and Delete endpoints that match existing request/response schemas and status codes.
  2. Preserve idempotency where applicable and return 404 vs 204 appropriately.
  3. Validate inputs and handle exceptions cleanly (e.g., 422 for invalid input, 404 for not found).
  4. Write unit tests covering all four endpoints (Create, Read, Update, Delete), including success and error paths.
  5. Explain how you would approach this if you have never used FastAPI before, leveraging existing endpoints as templates and the FastAPI documentation.

Solution

Show

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Credit Genie•More Software Engineer•Credit Genie Software Engineer•Credit Genie System Design•Software Engineer System Design
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.