API: is ETag If-Match honoured (concurrency/CAS)

Hi there,

Long story short: is ETag with If-Match honoured in the REST APIs? Is it reliable, in the sense of properly hashing the objects, to be used as the classical “optimistic locking” strategy for REST APIs?

TLDR:

In the organization that I work for we have created a bot that extends gitlab’s functionality. The bot does publish notes (reports) and changes labels.

It’s not infrequent that developers change labels at the same time bot is updating (e.g. removing a label, but not the same label as the ones touched by the bot). We use gitlab-python, and the result is that labels are incorrectly readded. Before going into checking the library itself (and maybe extending it), I wanted to be sure the underlying API does support it

For new features we are adding, we would need a way to properly (compare and swap) several elements in gitlab (notes, projects, issues…).

I couldn’t find any documentation on this area, btw, but might have missed it.

Thank you and regards
Marc