123
and 456
for your two articles.
/items/external-id/<YOUR_ITEM_EXTERNAL_ID>
endpoint.
In the body of the request, specify the item's name and content type.
See more details on upserting content items.
Import content by upserting a language variant.
Send a PUT request to the endpoint specifying the language variant you want to insert or update. In the body of the request, specify the values of individual content elements.
Notice that you are referencing the Donate with us item even though you haven't imported it yet. Such references are not visible in the UI.
"related_articles": [
{
"external_id": "456"
}
]
curl --request PUT \
--url https://manage.kontent.ai/v2/projects/<YOUR_ENVIRONMENT_ID>/items/external-id/123 \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-type: application/json' \
--data '
{
"name":"On Roasts",
"type":{
"codename":"article"
}
}'
curl --request PUT \
--url https://manage.kontent.ai/v2/projects/<YOUR_ENVIRONMENT_ID>/items/external-id/123/variants/codename/en-US \
--header 'authorization: Bearer <YOUR_API_KEY>' \
--header 'content-type: application/json' \
--data '
{
"elements":{
"title":"On Roasts",
"related_articles":[
{
"external_id":"456"
}
]
}
}'
curl --request PUT \
--url https://manage.kontent.ai/v2/projects/<YOUR_ENVIRONMENT_ID>/items/external-id/456 \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-type: application/json' \
--data '
{
"name":"Donate with us",
"type":{
"codename":"article"
}
}'
curl --request PUT \
--url https://manage.kontent.ai/v2/projects/<YOUR_ENVIRONMENT_ID>/items/external-id/456/variants/codename/en-US \
--header 'authorization: Bearer <YOUR_API_KEY>' \
--header 'content-type: application/json' \
--data '
{
"elements":{
"title":"Donate with us",
"related_articles":[
{
"external_id":"123"
}
]
}
}'