Versioning with Custom Attributes on Locations API

The documentation says that including the version number in an update is optional

  • version. To enable optimistic concurrency control for an update operation, include this optional field and specify the current version of the custom attribute.

For example, each Customer object has a version field. Initially, the version number is 0. For each successful update, Square increases the version number. If you do not specify a version number in an update request, the latest version is assumed.

I am not concerned with concurrency for what I am using this for.

Using the C# SDK if the version is not included in an update I am getting a
{“errors”:[{“code”:“BAD_REQUEST”,“detail”:“Missing required parameter version”,“field”:“version”,“category”:“INVALID_REQUEST_ERROR”}]}

Is this field actually required an I need to read the custom attribute first, increment the version, and then perform the update to get a webhook to fire?

Hey @ventavo! Thanks for flagging this. I’m checking with the team on what the expected behavior here is.

I confirmed with the team that the field is indeed required. The version field must match the current version of the custom attribute definition to enable optimistic concurrency control. If this is not important for your application, version can be set to -1. For any other values, the request fails with a BAD_REQUEST error.

We’ll get our docs updated to properly reflect that. Thanks again for raising this issue, @ventavo!