概要
StrapiのREST APIの一部設定に関する備忘録です。
検索結果の上限を変更する
以下に記載がありました。
Sort and Pagination | Strapi 5 Documentation
Use Strapi's REST API to sort or paginate your data.
具体的には、以下です。
The default and maximum values for pagination[limit] can be configured in the ./config/api.js file with the api.rest.defaultLimit and api.rest.maxLimit keys.
module.exports = {
rest: {
defaultLimit: 25,
maxLimit: 1000, // 100,
withCount: true,
},
};
STATEがDraftのものも含めて取得する
デフォルトではSTATEがDraftのものは取得できませんでした。以下の記事が参考になりました。

Can I expose an collection entry in draft-mode in the api for a certain user
If you want to avoid creating the route/controller, you can already search for those through the API by adding this after your article → ?_publicationState=preview&published_at_null=true Example: http://localhost:1337/articles?_publicationState=preview&published_at_null=true more info here → Content API - Strapi Developer Documentation
具体的には以下のようなクエリパラメータを追加することで取得できました。
?publicationState=preview&filters[publishedAt][$null]=true
まとめ
Strapiの利用にあたり、参考になりましたら幸いです。




コメント
…