New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Strapi 5] Updates to relations in API docs #2100
base: next
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
```js | ||
await strapi.documents('api::restaurant.restaurant').update({ | ||
documentId: 'a1b2c3d4e5f6g7h8i9j0klm', | ||
locale: 'fr', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Marc-Roig I'm not sure about this example. I did it by memory, trying to remember the exact syntax from our call. 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep! this is a valid syntax :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs looks good !
There are more complex scenarios that we might want to document , maybe they are more advanced and not as useful for the majority, but they might be useful to know.
- Relation from
Category (i18n off)
->Article (i18n on)
:
In this situation you can select which locale you are connecting
data: {
categories: {
connect: [
{ documentId: 'z0y2x4w6v8u1t3s5r7q9onm', locale: 'en' },
{ documentId: 'z0y2x4w6v8u1t3s5r7q9onm', locale: 'fr' }, // Connect to the same document id but different locale
]
}
}
- Relation from
Category (D&P off)
->Article (D&P on)
:
(Probably less relevant than the first one)
data: {
categories: {
connect: [
{ documentId: 'z0y2x4w6v8u1t3s5r7q9onm', status: 'draft' },
{ documentId: 'z0y2x4w6v8u1t3s5r7q9onm', status: 'published' }, // Connect to the same document id but different publication states
]
}
}
Note, on any api we expose the "documentId", the user will be able to reference both locale and status .
This PR: