> ## Documentation Index
> Fetch the complete documentation index at: https://doc.va777.net/llms.txt
> Use this file to discover all available pages before exploring further.

# 分頁與連續撈單

> 使用 nextToken 分頁查詢，以及連續撈取注單時避免漏單的方式。

## 分頁查詢

列表類 API 以 `nextToken` 與 `maxResults` 分頁：

* 連續的分頁查詢，除 `nextToken` 與 `sign` 外，其他條件參數都要相同；條件不同會被視為另一個查詢。
* 第一次查詢的 `nextToken` 帶入空字串，之後每次帶入上一次回傳的 `nextToken`。
* 直到回傳結果沒有任何資料且 `nextToken` 為空字串，該次查詢才算結束。

### 範例

以[取得注單列表](https://doc.va777.net/api-reference/betlog/list-by-time.md)為例，假設共有 12000 筆資料，每次取 5000 筆：

| 回合 | 輸入 nextToken | 輸入 maxResults | 輸出資料筆數 | 輸出 nextToken | 輸出 maxResults |
| - | - | - | - | - | - |
| 1 | （空字串） | 5000 | 5000 | `1stqwertuy` | 5000 |
| 2 | `1stqwertuy` | 5000 | 5000 | `2nddsv56hd` | 5000 |
| 3 | `2nddsv56hd` | 5000 | 2000 | `3rdtbg6jdh` | 5000 |
| 4 | `3rdtbg6jdh` | 5000 | 0 | （空字串） | 5000 |

## 連續撈取注單

使用[取得注單列表](https://doc.va777.net/api-reference/betlog/list-by-time.md)或[取得歷史注單列表](https://doc.va777.net/api-reference/betlog/history/list-by-time.md)撈取連續時間區間的注單作為紀錄與對帳時，為避免缺漏，**上一次的結束時間應等於本次的開始時間**。

以每次撈取 1 分鐘為例：

| 次數 | 開始時間 | 結束時間 |
| - | - | - |
| 1 | `2025-12-01T00:00:00.000+08:00` | `2025-12-01T00:01:00.000+08:00` |
| 2 | `2025-12-01T00:01:00.000+08:00` | `2025-12-01T00:02:00.000+08:00` |
| 3 | `2025-12-01T00:02:00.000+08:00` | `2025-12-01T00:03:00.000+08:00` |

> [!WARNING]
>
> 依上述方式撈取時，每連續兩次撈取，1 毫秒以下時間差距內的注單會被重複撈取，請自行去除重複注單。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.