A zero-dependency REST API for testing local API GUI tools while offline.
Recommended:
.\start-api.ps1Stop it later with:
.\stop-api.ps1Foreground mode, useful when you want to see logs directly:
python server.py --host 127.0.0.1 --port 8000Then open:
- Docs:
http://127.0.0.1:8000/docs - OpenAPI import URL:
http://127.0.0.1:8000/openapi.json - Health check:
http://127.0.0.1:8000/api/health
Run a quick check:
.\smoke-test.ps1Login with:
{
"email": "admin@example.com",
"password": "password123"
}Protected endpoints accept this header:
Authorization: Bearer offline-demo-token| Method | Endpoint | Purpose |
|---|---|---|
GET |
/api/health |
Health check |
POST |
/api/auth/login |
Return bearer token |
GET, POST |
/api/echo |
Echo headers, query params, and JSON body |
GET |
/api/delay?ms=1000 |
Test timeout/loading behavior |
GET |
/api/error?code=500 |
Force JSON error responses |
GET |
/api/products?q=keyboard&in_stock=true |
Public product listing and filtering |
POST |
/api/products |
Create product, protected |
GET, POST |
/api/users |
User collection, protected |
GET, PATCH, DELETE |
/api/users/{id} |
User resource, protected |
GET, POST |
/api/orders |
Order collection, protected |
GET, PATCH, DELETE |
/api/orders/{id} |
Order resource, protected |
Create user:
{
"name": "Sam Tester",
"email": "sam@example.com",
"password": "password123",
"role": "user"
}Create product:
{
"sku": "USB-C-HUB",
"name": "USB-C Hub",
"price": 59.99,
"stock": 25,
"tags": ["hardware", "accessory"]
}Create order:
{
"user_id": 2,
"items": [
{ "product_id": 1, "quantity": 1 },
{ "product_id": 2, "quantity": 2 }
]
}- Data is stored in memory and resets each time the server restarts.
- CORS is enabled for browser-based GUI clients.
- Responses include
X-Request-Id; you can also send your ownX-Request-Idheader. - Request bodies are limited to 1 MB.