When upserting an object using the Catalog API. Where do we get this version number that is required to update the object? Passing the version number returned when the object was created returns Object version does not match latest database version.
Omitting the version number returns the same error.
version integer(64-bit)
The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting.
I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:
If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.
When upserting an object using the Catalog API, the version number is crucial for ensuring that you are updating the most current version of the object. This is part of the optimistic concurrency control mechanism that prevents conflicting updates.
To get the correct version number for an object, you should retrieve the object using the RetrieveCatalogObject endpoint before performing an update. This endpoint will return the current version number of the object, which you can then use in your upsert request. If you attempt to use an outdated version number, you will encounter the “Object version does not match latest database version” error, indicating that the object has been modified since you last retrieved it.
Therefore, always ensure you have the latest version number by retrieving the object just before you perform an update.