I am trying to update a content entry, but I am always receiving a version mismatch 409 error even though the header (X-Contentful-Version) is being correctly set with the correct version number (12). The current entry version is 11.
I’ve installed “contentful-management” through npm (@5.6.0). I’ve tried it before with 5.7.0 to no avail. Here’s the response:
CONSOLE ERROR VersionMismatch: {
"status": 409,
"statusText": "Conflict",
"message": "",
"details": {},
"request": {
"url": "https://api.contentful.com:443/spaces/<spaceid>/environments/master/entries/1ExTmKaQet96QwtEfO76F3",
"headers": {
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/vnd.contentful.management.v1+json",
"X-Contentful-User-Agent": "sdk contentful-management.js/5.2.1;",
"Authorization": "Bearer ...5152b",
"X-Contentful-Version": 12
},
"method": "put",
"payloadData": "{\"fields\":{\"id\":{\"en-US\":1},\"movietitle\":{\"en-US\":\"API Panther\"}}}"
},
"requestId": "12ba512952d9442ddb458a7d2b81dddf"
}
My code looks like this:
client.getSpace('<spaceid>')
.then((space) => space.getEnvironment('master'))
.then((environment) => environment.getEntry('1ExTmKaQet96QwtEfO76F3'))
.then((entry) => {
entry.fields.movietitle['en-US'] = 'API Panther';
return entry.update()
})
.then((entry) => console.log(`Entry ${entry.sys.id} updated.`))
.catch(console.error)
I’ve just tried to do the same with the Insomnia REST client. My PUT request looks like this:
https://api.contentful.com/spaces/<spaceid>/environments/master/entries/<contentId>?access_token=<accesstoken>
And my JSON payload:
{ "fields": { "movietitle": { "en-US": "changed" } } }
But I am receiving also a Version Mismatch:
"sys": { "type": "Error", "id": "VersionMismatch" }
I’ve took the syntax for the request from the documentation .
As additional information: I am using a Personal Access Token for authentification.