LLM Skill
把整頁貼進你的 vibe-coding 工具(Cursor、Claude、Lovable、ChatGPT 等)當作 skill 或 系統提示。它包含 LLM 一次生成正確客戶端所需的全部資訊。
也可以直接連結原始 markdown:/api/public/llms.txt。
你正在串接 Data Platform,請遵守以下規則:
- 先探索再寫入。 先呼叫
GET /schema,欄位名稱完全比對。 - 不可自行虛構欄位。 缺欄位時,先
POST /tables/{table}/columns新增,再寫入資料列。 - People 走
/people,不是/tables/people/rows。 以matchKey: "email"或"student_id"upsert。 - 批次寫入用
{ "rows": [...] }。 每次上限 500 筆,超過請分批。 - 驗證僅需一組
Authorization: Bearer <TOKEN>header。 放環境變數,別寫死在前端。 - 假設有 RLS。 每一列都綁在 Token 所屬專案,跨專案讀不到。
- 欄位型別:
text、number、integer、boolean、date(ISO 字串)、url、media(URL 字串)。 - 錯誤回應為 JSON
{ error, detail? }加上 HTTP 狀態。 400 時把detail顯示給使用者(Zod issues)。 - Webhook 有 HMAC 簽章。 信任 payload 前用
sha256(secret + "." + raw_body)驗證x-df-signature。
Base URL
https://learnfun.metaprint.io/api/public/v1
驗證 header
Authorization: Bearer <PROJECT_API_TOKEN>
端點速查表
| Method | Path | 用途 |
|---|---|---|
| GET | /schema | 取得資料表與欄位 |
| POST | /tables | 建立資料表 |
| POST | /tables/{table}/columns | 新增欄位 |
| GET | /tables/{table}/rows | 列出資料列 |
| POST | /tables/{table}/rows | 插入一筆或多筆 |
| GET | /rows/{id} | 取得單筆資料列 |
| PATCH | /rows/{id} | 更新資料列(預設合併) |
| DELETE | /rows/{id} | 刪除資料列 |
| GET | /people | 列出 people |
| POST | /people | Upsert people |
| GET | /people/me | 以 email 或 auth_user_id 查 person |
| POST | /relationships | 建立跨資料表的欄位關聯 |
最精簡客戶端
const BASE = "https://learnfun.metaprint.io/api/public/v1";
const TOKEN = process.env.MY_APP_TOKEN;
async function api(path, init = {}) {
const res = await fetch(BASE + path, {
...init,
headers: {
"content-type": "application/json",
"authorization": `Bearer ${TOKEN}`,
...(init.headers ?? {}),
},
});
if (!res.ok) throw new Error(`API ${res.status}: ${await res.text()}`);
return res.json();
}