Skip to content
Structly Docs
한국어

Concepts

Concurrent edit conflicts

On this page

ETag and If-Match#

To keep you from unknowingly overwriting a change someone else saved first, Structly requires an ETag for edits and deletes.

  1. Check the etag in the detail response.
  2. Pass that value unchanged with --if-match when you edit or delete.
  3. If another change was saved in the meantime, the request is rejected and the record is not changed.
stly apis get 4pkKFh2ojXs --fields id,name
{"status":200,"etag":"\"api-json3-4pkKFh2ojXs-r1\"","location":null,"data":{"id":"4pkKFh2ojXs","name":"Orders API"}}

The etag value is a string that includes the double quotes. In the shell, wrap it in single quotes.

stly apis update 4pkKFh2ojXs --input api-update.json --if-match '"api-json3-4pkKFh2ojXs-r1"'

Edit responses do not include a new ETag. To edit the same entry again, look up the detail again to get the new etag.

When a conflict occurs#

SituationResult
Another change was saved after you looked up the entryHTTP 412 PRECONDITION_FAILED
Edit or delete without --if-matchstly does not send the request and ends with a usage error
{"kind":"http","status":412,"error":{"code":"412.000","reason":"PRECONDITION_FAILED","message":"요청을 처리할 수 없습니다.","data":[]},"outcome":"rejected"}

Resolve a conflict in this order. stly and the Web UI never save again automatically.

  1. Look up the same entry again to check the latest values and the new etag.
  2. Review whether the latest values conflict with the change you meant to apply.
  3. If needed, adjust your input to the latest values and edit again with the new etag.

In the Web UI, the message 최신 값을 먼저 확인하세요. (Check the latest values first.) appears and your input is kept. Select 최신 값 조회 (Look up latest values) to check the saved values, then edit again.

ETags for connection sets#

Connections, such as an API's providing Service, a Service's Repository connections, and a System's composition, use ETags separate from the entry itself. When you change a connection, use the etag from its lookup command.

stly apis service get 4pkKFh2ojXs

When the result is unclear#

If a timeout or connection error keeps you from confirming the result of a write, the outcome in the stly error is unknown. The request may have been applied, so look up the same entry to check its current state before sending it again.