Show Table of Contents
4.5. ページネーション制御のある検索の使用
per_page および page ページネーションパラメーターを使用して、API 検索クエリーが返す検索結果を絞り込むことができます。per_page パラメーターは、ページごとの項目数を指定し、page パラメーターは、per_page パラメーターで算出された数値をもとにどのページを返すかを指定します。
ページネーションパラメーターを指定しない場合に、返す項目数のデフォルト値を 1000 に設定しますが、
page パラメーターが指定されている場合にはper_page のデフォルト値は 20 が適用されます。
例4.6 コンテンツビューの表示
以下の例では、返された結果の 3 ページ目の 10 件分をリストするコンテンツビューが表示されます。
$ curl -X GET --user sat_username:sat_password \ "https://satellite6.example.com/katello/api/content_views?per_page=10&page=3"
例4.7 アクティベーションキーの表示
以下の例では、ID が 1 の組織のアクティベーションキー 30 個を 1 ページにリストする検索の 2 ページ目を表示します。
$ curl -X GET --user sat_username:sat_password \ "https://satellite6.example.com/katello/api/activation_keys?organization_id=1&per_page=30&page=2"
複数ページを表示する結果を取得するには、for loop の構造を使用します。
例4.8 複数ページを返す設定
以下の例では、ページごとに 5 件ずつ表示するコンテンツビュー 3 ページ分の 1 ページを返します。
$ for i in `seq 1 3`; do curl -X GET --user sat_username:sat_password \ "https://satellite6.example.com/katello/api/content_views?per_page=5&page=$i"; done

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.