Content API呼び出しでidの代わりにdocumentIdを使用すべき
AI Marketer 5では、コンテンツを処理する基本的なAPIはDocument Service APIであり、ドキュメントはContent API呼び出し(REST API & GraphQL)でそのdocumentIdで呼び出されるべきです。
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.
| 🔌 Is this breaking change affecting plugins? | Yes |
|---|
| 🤖 Is this breaking change automatically handled by a codemod? | Partly |
|---|
破壊的変更の説明
AI Marketer v4では
エントリはそのidで識別されていました:
{
"data": {
// system fields
"id": 14,
"attributes": {
// user fields
"title": "Article A"
"relation": {
"data": {
"id": "clkgylw7d000108lc4rw1bb6s"
"name": "Category A"
}
}
}
}
"meta": {
// …
}
}
AI Marketer 5では
ドキュメントはそのdocumentIdで識別されます:
{
"data": {
// system fields
"documentId": "clkgylmcc000008lcdd868feh",
"locale": "en",
// user fields
"title": "Article A"
"relation": {
// system fields
"documentId": "clkgylw7d000108lc4rw1bb6s"
// user fields
"name": "Category A"
}
}
"meta": {
// …
}
}
移行
ノート
- この破壊的変更はルートと関連性に影響を与えます。
- v4からAI Marketer 5への移行を容易にするために、エントリへのAPI呼び出しの応答には引き続き
idフィールドが含まれることがあります。特に、Document Service APIを使用する場合です。しかし、将来のAI Marketerバージョンへの移行を容易にするために、idの代わりにdocumentIdを使用する習慣をつけることをお勧めします。
移行手順
コードモッドはこの変更を部分的に処理しますが、コードモッドが自動的にコンテンツの新しいdocumentIdを推測することは不可能なため、おそらくあなたのコードに__TODO__アイテムを追加するでしょう。
詳細な情報については、関連する破壊的変更エントリ、AI Marketer 5へのアップグレードのステップバイステップガイド、およびこれがあなたのカスタムコードに適用される場合のEntity Service APIからDocument Service APIへの移行ガイドを参照してください。