Skip to content

Camden-Kirkpatrick/helpdesk-api

Repository files navigation

Helpdesk API (FastAPI + SQLModel + SQLite)

A small REST API that models a helpdesk ticket workflow.
Demonstrates CRUD operations, validation, search filtering, and partial updates (PATCH) backed by a SQLite database.


Tech

  • FastAPI
  • SQLModel (SQLAlchemy + Pydantic)
  • SQLite
  • Docker

Features

  • Create tickets (POST)
  • List tickets (GET)
  • Get ticket by ID (GET)
  • Search tickets via query parameters (GET)
  • Update tickets partially (PATCH)
  • Delete tickets (DELETE)
  • Enum-restricted status: open | in_progress | closed
  • Priority validation: 1–5

Setup (Non-Docker)

1) Create a virtual environment

python -m venv .venv

2) Activate the virtual environment (manual)

You only need to do this if you are NOT using the provided run script.

Windows (Command Prompt):

.venv\Scripts\activate

macOS / Linux:

source .venv/bin/activate

3) Install dependencies

pip install -r requirements.txt

Run the API

Option 1) Run manually (any platform)

uvicorn main:app --reload

Option 2) Run using the provided script (Windows only):

run_api.cmd

Open:


Setup using Docker (recommended)

Build the image:

docker build -t helpdesk-api .

Run the container:

docker run --rm -p 8000:8000 helpdesk-api

Demo client

⚠️ The API must be running in a separate terminal before running the demo client.

Run the demo script (creates tickets, patches, searches, deletes):

Option 1) Run manually (any platform)

python demo_client.py

Option 2) Run using the provided script (Windows only):

run_demo.cmd

Endpoints

Create ticket

POST /tickets/

Body:

{
  "title": "Printer not working",
  "description": "Office printer keeps jamming",
  "priority": 3
}

Response (example):

{
  "id": 1,
  "title": "Printer not working",
  "description": "Office printer keeps jamming",
  "priority": 3,
  "status": "open"
}

List tickets

GET /tickets/?offset=0&limit=100


Get ticket by ID

GET /tickets/{ticket_id}


Search tickets

GET /tickets/search?priority=5&status=open


Patch ticket

PATCH /tickets/{ticket_id}

Body (example):

{
  "status": "in_progress"
}

Delete ticket

DELETE /tickets/{ticket_id}


Notes

  • The SQLite database file (database.db) is intentionally not committed.
  • Database tables are created automatically on application startup.
  • The API is stateless and follows REST conventions.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published