ページネーション
Updated: 5月 21, 2026
Altium 365 API は、Relay connection specification に従ったカーソルベースのページネーションを使用します。コレクションのクエリは、ノードのリスト、ページネーションのメタデータ、および結果を前後にたどるためのカーソルを含む connection 型を返します。
コネクションの構造
ページネーションされたレスポンスは、次の形式になります。
query {
someCollection {
nodes { # the items on this page
...
}
pageInfo { # pagination metadata
hasNextPage
hasPreviousPage
startCursor
endCursor
}
totalCount # total number of items (all pages)
}
}
ページの取得
コレクションを前方向にページングするには、first 引数と after 引数を使用します。
query {
desProjects(first: 20, after: "{cursor}") {
nodes {
id
name
}
pageInfo {
hasNextPage
endCursor
}
}
}
-
first– 返す項目数(ページサイズ) -
after– 前のページの末尾を示すカーソル。最初のリクエストでは省略します
endCursor の pageInfo が、次のページの after の値になります。hasNextPage が false になるまで続けます。
後方向にページングするには、last および before を startCursor とともに使用します。
最初のリクエスト
最初のページでは、after 引数を省略します。
query {
desProjects(first: 20) {
nodes {
id
name
updatedAt
}
pageInfo {
hasNextPage
endCursor
}
totalCount
}
}
ページネーションを開始する前に、想定されるページ数を判断するには totalCount を使用します。
項目を取得せずに件数を数える
合計件数だけが必要な場合は、nodes を完全に省略できます。
query {
desProjects {
totalCount
}
}