概要
以下の記事を参考に、DrupalのRESTful Viewsを使ってカスタムAPIを作成したので、その備忘録です。
https://acret.jp/drupal/node/434
上記の記事の内容に加えて、ページネーションに関する設定方法も記載しています。
Viewsの作成
上記のサイトの通りに進めました。




ページネーションを許可する
以下の記事を参考にしました。
https://www.drupal.org/forum/support/post-installation/2015-12-04/rest-export-pagination
ViewsのPagerを選択します。以下の通り、Fullとしました。Miniでも大丈夫そうでした。

「Allow user to control the number of items displayed in this view」と「Allow user to specify number of items skipped from beginning of this view.」にチェックを入れます。

結果、以下のようなパラメータが使えるようになりました。
/my_custom_api?items_per_page=10
/my_custom_api?items_per_page=10&offset=1
/my_custom_api?items_per_page=50
まとめ
カスタムAPIを作成する際の参考になりましたら幸いです。