API Design · Middle · Question 19 of 75
Two clients edit the same document. How can an API prevent one from silently overwriting the other?
- 1Lock the resource for each client for an hour
- ✓Correct answer: Optimistic concurrency: clients send
If-Match: <etag>; if the resource changed, the server answers412 Precondition Failed - 3Let the last write win always
Explanation
The client then reloads, merges or asks the user. 428 Precondition Required can force clients to send If-Match.