Skip to content

About

REST API for fleet data management.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Enterprise Fleet Data API

Centralized FastAPI + Swagger/OpenAPI service for the Fleet Manager architecture, powered by PostgreSQL.


Environment Setup

Create a .env file in the root directory (see .env.example):

DATABASE_URL=postgresql://neondb_owner:your_password@ep-your-project.us-east-2.aws.neon.tech/neondb?sslmode=require

Local Development

python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
python import_data.py
uvicorn app.main:app --reload
  • Interactive Swagger Docs: http://127.0.0.1:8000/docs
  • Root URL: Automatically redirects to /docs
  • OpenAPI Schema: http://127.0.0.1:8000/openapi.json

Deploy to the Internet (Render)

  1. Push your updated code to GitHub:
    git add .
    git commit -m "Migrate database to PostgreSQL"
    git push origin main
  2. In the Render Dashboard:
    • Go to your Web Service (fleet-data-api).
    • Navigate to Environment.
    • Add an environment variable:
      • Key: DATABASE_URL
      • Value: postgresql://neondb_owner:...@ep-...neon.tech/neondb?sslmode=require
    • Click Save Changes.
  3. Render will redeploy your service automatically and connect to the PostgreSQL database!

Main Endpoints

Method Endpoint Description
GET / Redirects to /docs
GET /api/v1/health System health and timestamp
GET /api/v1/fleet/summary Aggregate statistics by status, connectivity, and warranty
GET /api/v1/offices List of all office locations and device counts
GET /api/v1/offices/{office_id}/devices Devices located in a specific office
GET /api/v1/devices Paginated and filtered devices inventory
GET /api/v1/devices/{device_id} Detailed device specification and telemetry
GET /api/v1/devices/{device_id}/health Device operational health status
GET /api/v1/devices/{device_id}/warranty Device warranty information and remaining days
GET /api/v1/warranty Warranty list filtered by status
GET /api/v1/alerts Critical alerts for devices requiring attention

About

REST API for fleet data management.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages