API 규칙
페이지네이션
커서 기반 페이지네이션으로 대량 데이터 탐색하기
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
New: Stripe & TossPayments integration guides now available →
커서 기반 페이지네이션으로 대량 데이터 탐색하기
| 파라미터 | 타입 | 기본값 | 설명 |
|---|---|---|---|
limit | integer | 20 | 페이지당 항목 수 (1–100) |
starting_after | string | — | 커서: 이 ID 이후의 항목 반환 |
{
"data": [
{ "id": "prod_abc", "name": "Product A" },
{ "id": "prod_def", "name": "Product B" }
],
"has_more": true,
"next_cursor": "prod_def"
}
| 필드 | 타입 | 설명 |
|---|---|---|
data | array | 항목 목록 |
has_more | boolean | 이 페이지 이후에 더 많은 항목이 있는지 여부 |
next_cursor | string | null | 다음 페이지를 위해 starting_after로 전달할 ID |
let cursor: string | undefined;
const allProducts = [];
do {
const params = new URLSearchParams({ limit: '100' });
if (cursor) params.set('starting_after', cursor);
const res = await fetch(
`https://api.headlesscommerce.io/v1/storefront/products?${params}`,
{ headers: { Authorization: `Bearer ${apiKey}` } },
);
const body = await res.json();
allProducts.push(...body.data);
cursor = body.has_more ? body.next_cursor : undefined;
} while (cursor);
# 상태 필터 + 생성일 기준 정렬
GET /v1/admin/products?status=active&sort=created_at&order=desc&limit=50