publishedAt 被删除并由 status 替换
¥publishedAt is removed and replaced by status
在 Strapi 5 中,草稿和发布功能 已被重新设计,并且内容 API(包括 REST、GraphQL 和文档服务 API)接受新的 status 参数。
¥In Strapi 5, the Draft & Publish feature has been reworked, and the Content API, including REST, GraphQL, and Document Service APIs accept a new status parameter.
此页面是 重大变更数据库 的一部分,提供有关重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的其他说明。
¥This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.
| 🔌 此重大更改是否会影响插件? | 是 |
|---|
| 🤖 此重大更改是否由 codemod 自动处理? | 是 |
|---|
重大更改描述
¥Breaking change description
在 Strapi v4 中
¥In Strapi v4
publishedAt 用于请求正文并接受以下值:
¥publishedAt is used in the request body and accepts the following values:
-
null在草稿中设置一个条目,¥
nullsets an entry in draft, -
日期字符串(例如
2021-10-28T16:57:26.352Z)将条目设置为已发布状态。¥A date string (e.g.,
2021-10-28T16:57:26.352Z) sets the entry to published status.
在 Strapi 5 中
¥In Strapi 5
status 用作查询参数并接受以下值:
¥status is used as a query parameter and accepts the following values:
-
draft在草稿版本中设置 a,¥
draftsets a in the draft version, -
published在已发布版本中设置 a。¥
publishedsets a in the published version.
迁移
¥Migration
本节重新组合了有关引入的重大更改的有用说明和程序。
¥This section regroups useful notes and procedures about the introduced breaking change.
注意
¥Notes
-
有关如何使用新
status参数的更多信息,请参阅 REST API、GraphQL API 和 文档服务 API 文档。¥Additional information about how to use the new
statusparameter can be found in the REST API, GraphQL API, and Document Service API documentation.
迁移程序
¥Migration procedure
-
从使用
publishedAt的前端(REST API、GraphQL API)发起的 API 调用需要手动更新。¥API calls initiated from the front end (REST API, GraphQL API) that used
publishedAtneed to be manually updated.