分頁
名稱是 _search 的 tool 回摘要、用 cursor 一頁一頁拿;名稱是 _get 的回一筆的全部欄位。
查詢的 tool 分兩種:
| 種類 | 例子 | 回什麼 |
|---|---|---|
_search | bill_search、order_search、payment_search | 符合條件的摘要,一次一頁 |
_get | bill_get、order_get、quote_get | 一筆資料的全部欄位 |
先用 _search 找到要的那一筆,再用 _get 讀明細。
一頁一頁拿
_search 的參數:
limit:一頁幾筆,預設 20,最多 100。cursor:第一頁不帶;之後帶上一頁回的next_cursor。
回傳是 { "items": [...], "next_cursor": ... }。next_cursor 是 null 就是沒有下一頁了。
{
"status": "UNPAID",
"limit": 20
}
{
"ok": true,
"data": {
"items": [
{
"id": "0b6f2c1e-6a43-4d1f-9e3a-5b7c8d9e0f12",
"number": "BL-000123",
"status": "UNPAID",
"buyer_name": "晨光咖啡有限公司",
"currency": "TWD",
"total": "12600",
"paid": "0",
"balance": "12600",
"due_date": "2026-11-20",
"overdue_days": null,
"linked_customer": null
}
],
"next_cursor": "eyJ0IjogImJpbGxfc2VhcmNoIiwgImMiOiAiLi4uIn0="
}
}
下一頁:
{
"status": "UNPAID",
"limit": 20,
"cursor": "eyJ0IjogImJpbGxfc2VhcmNoIiwgImMiOiAiLi4uIn0="
}
- 換頁時其他篩選條件要跟第一頁一樣。
cursor只能用在拿到它的那個 tool;拿去別的 tool 用會回VALUE_INVALID。- 篩選條件跟網站的列表一樣,每個 tool 有哪些條件見 Tool 參考。
摘要有哪些欄位
| tool | 摘要的欄位 |
|---|---|
quote_search | id、number、status、buyer_name、currency、total、valid_until、created_at |
order_search | id、number、status、billing_status、buyer_name、currency、total、unbilled_amount、created_at |
bill_search | id、number、status、buyer_name、currency、total、paid、balance、due_date、overdue_days |
| 付款、退款、金流交易、發票、寄信紀錄、稽核紀錄 | 跟網站列表的欄位一樣 |
找不到的時候
_get 找不到會回跟網站一樣的代碼,例如 BILL_NOT_FOUND、ORDER_NOT_FOUND。照 hint 用 _search 找正確的編號或 id。