Contentful logo

Contentful Community

Unable to patch entity

Hello,
I tried to update one of my content type’s entity using patch verb and CM API as discribed here Content Management API | Contentful but I can’t do that due to

{
    "sys": {
        "type": "Error",
        "id": "VersionMismatch"
    },
    "requestId": "07d7fdbe-6596-4448-8c6c-9e46e405364a"
}

error.

Here’s what I did:

  1. I retrieved entry using Content API
  2. I retrieved sys.revision value (currently value is equal 5)
  3. I executed following request
curl --location --request PATCH 'https://api.contentful.com/spaces/SPACE/environments/master/entries/ENTRY_ID' \
--header 'X-Contentful-Version: 5' \
--header 'Content-Type: application/json-patch+json' \
--header 'Authorization: Bearer XXX' \
--data-raw '[
  { "op": "replace", "path": "/title", "value": "New title" }
]'

Can you help me with that?
Thanks in advance

Hey @mszopa, could you try the same query with sys.version? It is retrieved via CM API.

In summary, sys.version is the current version, sys.revision is the published version of an entry.

That worked for CM API, didn’t work for preview API (it doesn’t provide any information about entity version)