REST API Reference
รูปแบบ Response มาตรฐาน:
- สำเร็จ:
{ "data": ... } - ผิดพลาด:
{ "error": { "code": "...", "message": "..." } }
System & Health
Section titled “System & Health”| Method | Path | สิทธิ์ | คำอธิบาย |
|---|---|---|---|
GET |
/health |
Public | เช็คสถานะ server, version และ cache backend |
GET |
/api/system/update/check |
Superuser | ตรวจ release ล่าสุดจาก GitHub (?to=vX.Y.Z, ?force=1) |
POST |
/api/system/update/apply |
Superuser | ทดสอบ dry-run ({"dry_run": true}) หรืออัปเดต binary ({"dry_run": false}) |
Superusers
Section titled “Superusers”| Method | Path | สิทธิ์ | คำอธิบาย |
|---|---|---|---|
GET |
/api/superusers/status |
Public | เช็คว่าต่อ DB แล้วและมี superuser หรือยัง |
POST |
/api/superusers/setup |
Public (รอบแรก) | สร้าง superuser คนแรกด้วย Setup OTP 8 หลัก |
POST |
/api/superusers/auth-with-password |
Public | ล็อกอิน Admin (ตั้ง HttpOnly cookie + คืน JWT) |
POST |
/api/superusers/logout |
Superuser | ล้าง Admin session cookie |
Collections & Records
Section titled “Collections & Records”| Method | Path | สิทธิ์ | คำอธิบาย |
|---|---|---|---|
GET / POST |
/api/collections |
Superuser | ดูรายการ / สร้าง Collection |
GET / PATCH / DELETE |
/api/collections/:name |
Superuser | ดู / แก้ไข / ลบ Collection |
GET / POST |
/api/collections/:name/records |
ตาม API Rules | ดึงรายการ (?filter, ?sort, ?expand, ?fields, ?page, ?perPage) / สร้าง record |
GET / PATCH / DELETE |
/api/collections/:name/records/:id |
ตาม API Rules | ดู / แก้ไข / ลบ record ตาม ID |
POST |
/api/collections/:name/vector-search |
ตาม list_rule |
ค้นหา pgvector similarity |
POST |
/api/batch |
ตาม API Rules | รันหลายคำขอใน transaction เดียว |
Realtime & Files
Section titled “Realtime & Files”| Method | Path | สิทธิ์ | คำอธิบาย |
|---|---|---|---|
GET / POST |
/api/realtime |
Public / Token | เปิด SSE stream และสมัครรับ event |
POST |
/api/files/token |
Auth / Superuser | ขอ short-lived file token |
GET |
/api/files/:collection/:recordId/:filename |
ตาม view_rule |
ดาวน์โหลดไฟล์หรือ thumbnail (?thumb=300x300) |
Settings, Ops & SQL (Superuser)
Section titled “Settings, Ops & SQL (Superuser)”| Method | Path | คำอธิบาย |
|---|---|---|
GET / PUT |
/api/settings/app |
ตั้งค่าแอป (GET คืนเฉพาะฟิลด์สาธารณะถ้าไม่ใช่ superuser) |
GET / PUT |
/api/settings/database |
ดู/บันทึกการเชื่อมต่อ PostgreSQL (คืน 409 CONFIG_MANAGED เมื่อจัดการผ่าน microbase.conf) |
POST |
/api/settings/database/test |
ทดสอบเชื่อม PostgreSQL |
GET / PUT |
/api/settings/redis |
ดู/สลับ Redis cache |
GET / PUT |
/api/settings/s3 |
ดู/สลับ S3 storage |
GET / PUT |
/api/settings/mail |
ดู/ตั้งค่า SMTP + POST /api/settings/mail/test |
GET / POST / DELETE |
/api/backups |
จัดการ backup (POST /api/backups/:name/restore เพื่อ restore) |
GET / POST / PATCH / DELETE |
/api/webhooks, /api/crons |
จัดการ Webhooks และ Cron Jobs |
GET |
/api/logs |
ดู HTTP request logs |
POST |
/api/sql |
รัน SQL query โดยตรง |