使用 Strapi 的交互式工具构建你的查询 URL
🌐 Build your query URL with Strapi's interactive tool
可以使 用并组合各种参数通过REST API查询你的内容,这可能会导致长且复杂的查询URL。
🌐 A wide range of parameters can be used and combined to query your content with the REST API, which can result in long and complex query URLs.
Strapi 的代码库使用 `qs` 库 来解析和序列化嵌套的 JavaScript 对象。建议直接使用 qs 来生成复杂的查询 URL,而不是手动创建它们。
🌐 Strapi's codebase uses the `qs` library to parse and stringify nested JavaScript objects. It's recommended to use qs directly to generate complex query URLs instead of creating them manually.
你可以使用以下交互式查询构建器工具自动生成查询 URL:
🌐 You can use the following interactive query builder tool to generate query URLs automatically:
- 将 Endpoint 和 Endpoint Query Parameters 字段中的值替换为适合你需求的内容。
- 点击 复制到剪贴板 按钮以复制自动生成的 查询字符串 URL,该 URL 会随着你输入而更新。
请参阅REST API 参数表并阅读相应的参数文档页面,以更好地理解参数的使用。
🌐 Please refer to the REST API parameters table and read the corresponding parameters documentation pages to better understand parameters usage.
默认的端点路径以 /api/ 为前缀,除非你使用 rest.prefix API 配置选项 配置了不同的 API 前缀,否则应保持不变。
例如,要使用默认 API 前缀查询 books 集合类型,请在 Endpoint 字段中输入 /api/books。
本页面提供的 qs 库和交互式查询构建器:
🌐 The qs library and the interactive query builder provided on this page:
- 可能无法检测到所有语法错误,
- 不知道 Strapi 项目中可用的参数和值,
- 并且不提供自动补齐功能。
目前,这些工具仅用于将 JavaScript 对象转换为内联查询字符串 URL。使用生成的查询 URL 并不保证你的 API 能返回正确的结果。
🌐 Currently, these tools are only provided to transform the JavaScript object in an inline query string URL. Using the generated query URL does not guarantee that proper results will get returned with your API.