I have created a content in contentful.com. Was going through the api document, I tried the GET API to access the content, but i don't see edit/update content API anywhere in the document. Has anyone got any solution for it?
I found a document https://www.contentful.com/developers/docs/references/content-management-api/#/introduction/updating-content This document says "Contentful doesn't merge changes made to content, so when updating content, you need to send the entire body of an entry."
For which i made a GET call a gathered the entire body. But I dont see status in the whole body which i need to upgrade.
Below is the content's body:
{
"metadata": {
"tags": []
},
"sys": {
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "fdgre4353"
}
},
"id": "xzvcfd5434",
"type": "Entry",
"createdAt": "2023-04-14T05:46:22.768Z",
"updatedAt": "2023-04-14T05:47:27.521Z",
"environment": {
"sys": {
"id": "master",
"type": "Link",
"linkType": "Environment"
}
},
"revision": 2,
"contentType": {
"sys": {
"type": "Link",
"linkType": "ContentType",
"id": "carousal"
}
},
"locale": "en-US"
},
"fields": {
"name": "Test-by-dnt",
"panels": [
{
"sys": {
"type": "Link",
"linkType": "Entry",
"id": "dsfw4e54332432fvdf"
}
},
{
"sys": {
"type": "Link",
"linkType": "Entry",
"id": "dsfvdft5e4tr43fg"
}
}
]
}
}
In the body that you send in the PUT request, you need to change the content you wish to update. For example, for one of my entries, I received the following output:
Now that I want to update only the title, this is what I send in the body (I just update the title, the rest remains the same):
Note that in your request, you also need to pass the
X-Contentful-Versionheader. The GET response provides the current version of the entry.Hope this helps.