API 配置
🌐 API configuration
Page summary:
/config/api集中管理响应隐私、REST 默认设置(前缀、分页限制 、最大请求大小)以及对 REST 内容 API 和文档服务的严格参数验证。
API 调用的一般设置可以在 ./config/api.js(或 ./config/api.ts)文件中设置。rest 和 documents 选项都在这个单一的配置文件中。
🌐 General settings for API calls can be set in the ./config/api.js (or ./config/api.ts) file. Both rest and documents options live in this single config file.
| 属性 | 描述 | 类型 | 默认 |
|---|---|---|---|
responses | 全局 API 响应配置 | 对象 | - |
responses.privateAttributes | 一组全局定义的属性,应被视为私有。 | 字符串数组 | [] |
rest | REST API 配置 | 对象 | - |
rest.prefix | API 前缀 | 字符串 | /api |
rest.defaultLimit | API 调用中使用的默认 limit 参数(参见 REST API 文档)。将其设置为 -1 可以移除限制(见下方说明)。 | 整数 | 25 |
rest.maxLimit | 可以作为 limit 请求的最大允许数量(参见 REST API 文档)。 | 整数 | 100 |
rest.withCount | 列表响应是否默认包含 meta.pagination 中条目总数和页数。可以通过 pagination[withCount] 参数在每次请求中覆盖。 | 布尔值 | true |
rest.strictParams |