Serve flat files (CSV, XLSX, JSON) as a local REST API instantly.
Project description
⚡ flatapicli
Serve flat files (CSV, XLSX, JSON) as a local REST API instantly.
Install
pip install flatapicli
Usage
# Start the server pointing at a directory
flatapicli serve --dir ./data
# Custom port
flatapicli serve --dir ./data --port 8080
# Expose to network (VPS / LAN)
flatapicli serve --dir ./data --host 0.0.0.0
# Auto-reload store on file change (no server restart)
flatapicli serve --dir ./data --watch
# Inspect files without starting server
flatapicli list-files --dir ./data
While running:
r+ Enter → reload data files without restarting serverq+ Enter → clean shutdown
URL Structure
Given a directory with products.csv, orders.xlsx (sheets: jan, feb), and users.json:
| URL | Response |
|---|---|
GET / |
All loaded files |
GET /products/api |
Schema, columns, row count |
GET /products/api/rows |
All rows |
GET /products/api/rows?limit=10&offset=0 |
Paginated rows |
GET /products/api/name |
All values in column name |
GET /orders/api |
Schema for all sheets |
GET /orders/api/jan/rows |
All rows in sheet jan |
GET /orders/api/jan/amount |
Column amount from sheet jan |
GET /orders/api/jan/amount/0 |
Single cell: row 0, column amount, sheet jan |
Supported Formats
| Format | Extension | Multi-sheet |
|---|---|---|
| CSV | .csv |
No |
| Excel | .xlsx, .xls |
Yes |
| JSON | .json |
Yes (object of arrays) |
JSON format
Single sheet (array of objects):
[{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}]
Multi-sheet (object of arrays):
{
"users": [{"id": 1, "name": "Alice"}],
"admins": [{"id": 99, "name": "Root"}]
}
Interactive Docs
Custom Swagger UI with chained dropdowns (File → Sheet → Column) available at http://localhost:3000/docs.
Deployment (VPS)
pip install flatapicli
flatapicli serve --dir /data/files --host 0.0.0.0 --port 3000
Run behind nginx or use a systemd service for production stability.
Contributing
TOON (Token-Oriented Object Notation) parser contributions welcome. Add a parser in flatapicli/parsers/ following the existing pattern and register it in flatapicli/parsers/__init__.py.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flatapicli-0.1.0.tar.gz.
File metadata
- Download URL: flatapicli-0.1.0.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3239b9137deae286f9b95437e80837c21abf202c09a58e6d93df23be7e1a59e1
|
|
| MD5 |
97f7c6ec769295644f4bc2db191b9445
|
|
| BLAKE2b-256 |
f60322d73641c2c0797bedab01bf811e495d80b0ec1a67854c23c659d731484f
|
File details
Details for the file flatapicli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: flatapicli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35c0465f33fba89ad4377e45fe3986090c3dde3f2b5078adf3948233bc64b85b
|
|
| MD5 |
65935968112d8e6605ae4445bb6554a5
|
|
| BLAKE2b-256 |
53932fecea530ecdc0bf59344de1c2174348f2b79d8f7ffe956551a31cc75983
|