You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**KEEP AN EYE ON IT**: The [Idempotency-Key Request header](https://tools.ietf.org/id/draft-idempotency-header-01.html) is in an experimental state but getting lots of attention as a pattern of making fault-tolerant resilient requests for traditionally non-idempotent methods like `POST`.
449
-
```
450
-
451
445
### Custom Headers
452
446
453
447
- Custom Headers **MAY** be used and created as necessary.
@@ -494,6 +488,8 @@ The usage of non-standard headers is not considered custom headers. For example,
494
488
Sps-Cors-Error: bad origin
495
489
```
496
490
491
+
<hr />
492
+
497
493
#### Sps-Execution-Context
498
494
499
495
**Type**: Both
@@ -527,6 +523,36 @@ Sps-Execution-Context: // values must be at least a character l
527
523
Sps-Execution-Context: 1 // valid, but SHOULD be human-readable.
528
524
```
529
525
526
+
<hr />
527
+
528
+
#### Sps-Idempotency-Key
529
+
530
+
**Type**: Request
531
+
532
+
**Support**: OPTIONAL
533
+
534
+
**Description**: An idempotency key is a unique value generated by the client which the resource server uses to recognize subsequent retries of the same request. The HTTP `Idempotency-Key` request header field can be used to carry an "idempotency key" to make non-idempotent HTTP methods such as POST or PATCH fault-tolerant (related to expired RFC for [Idempotency HTTP Header Field](https://datatracker.ietf.org/doc/html/draft-idempotency-header-01)). An API must persist the Idempotency-Key in a stateful way to manage idempotency. It is common to include the idempotency key as part of the primary key or as a secondary index for the resource.
535
+
536
+
- The header value **MUST NOT** be shorter than 20 characters or longer than 255.
537
+
- The header value **MUST** not be used for `GET` requests.
538
+
- The header value **MUST** follow this regex format: `[a-z0-9-]{20,255}`.
539
+
- An API **MUST** return a `400` status code when the header value is in an invalid format with an appropriate error message.
540
+
- If an action is idempotent, an API **MUST** return a `2xx` status code on conflict.
541
+
- If an action is not idempotent, an API **MUST** return a `409` status code on conflict.
542
+
- An API **MAY** treat this as the final primary ID of the resource or as part of the ID.
543
+
- The header value **SHOULD** typically be a V4 UUID as a string or another random string with enough entropy to avoid collisions.
544
+
- The header value **MUST** be generated by the client or client library.
0 commit comments