Skip to main content

REST API 参数

🌐 REST API parameters

API 参数可以与 REST API 一起使用,以筛选、排序和分页结果,并选择要填充的字段和关联。此外,还可以使用与可选 Strapi 功能相关的特定参数,例如内容类型的发布状态和语言环境。

🌐 API parameters can be used with the REST API to filter, sort, and paginate results and to select fields and relations to populate. Additionally, specific parameters related to optional Strapi features can be used, like the publication state and locale of a content-type.

以下 API 参数可用:

🌐 The following API parameters are available: | 运算符 | 类型 | 描述 || --- | --- | --- || filters | 对象 | 过滤响应 || locale | 字符串 | 选择一个区域设置 || status | 字符串 | 选择草稿和发布状态 || populate | 字符串或对象 | 填充关联、组件或动态区域 || fields | 数组 | 仅选择要显示的特定字段 || sort | 字符串或数组 | 对响应进行排序 || pagination | 对象 | 分页浏览条目 |

Note

参数中的长括号编码列表(例如 populatefields)受 arrayLimitstrapi::query 的限制。参见 Population

🌐 Long bracket-encoded lists in a parameter (for example populate or fields) are limited by arrayLimit on strapi::query. See Population.

查询参数使用 LHS bracket syntax (即它们使用方括号 [] 编码)。

Tip

可以使用和组合广泛的 REST API 参数来查询你的内容,这可能会导致长且复杂的查询 URL。
👉 你可以使用 Strapi 的交互式查询构建器工具更方便地构建查询 URL。🤗