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
Copy file name to clipboardExpand all lines: standards/request-response.md
+38Lines changed: 38 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -525,6 +525,44 @@ Sps-Execution-Context: 1 // valid, but SHOULD be human-readable.
525
525
526
526
<hr />
527
527
528
+
#### Sps-Service
529
+
530
+
**Type**: Both
531
+
532
+
**Support**: OPTIONAL
533
+
534
+
**Description**: The `Sps-Service` header conveys metadata about the requesting asset or service within the ecosystem. It includes details such as the requesting service's identifier, name, and potentially additional attributes. This information supports logging, monitoring, and auditing by identifying the service responsible for the request. Unlike the `User-Agent` header, which describes the client or user initiating the request, `Sps-Service` focuses on the ownership and identity of the service making the request.
535
+
536
+
- The header **MUST** follow a key-value format with `=` as the delimiter. Attributes **MUST** be delimited by a semicolon `;`.
537
+
- The header key names **MUST** follow `camelCase` naming conventions.
538
+
- The header value **MUST** provide the service identifier using the key name `id` as a valid UUID format.
539
+
- The header value **SHOULD** provide the service name using the key name `name`, represented by the following regex: `[a-z0-9-]{1,60}`.
540
+
- The header value **MAY** extend or include additional attributes as necessary for the service or application.
541
+
- The header value **MUST** represent the attributes of a single service or application (not multiple).
542
+
- The header **SHOULD** be used alongside `User-Agent` to provide complete requesting context.
543
+
- The header **SHOULD** be used for all requests made to a service by the requesting service or application (either server or client side).
544
+
- Library or Service metadata and versions **MUST NOT** be included in this header. This information **SHOULD** be included in the `User-Agent` header.
545
+
- Requests with an invalid `Sps-Service` formatted header **SHOULD** return a `400` response status code.
546
+
- Requests **MAY** validate the `Sps-Service` header `id` value against the associated authority or service registry. Validation failures **MUST** return a `400` indicating the reason.
547
+
548
+
```
549
+
// CORRECT
550
+
Sps-Service: id=d4f885c5-2196-49c0-ba69-bc70008585ad;name=transform-service // standard representation with id and name. Suffixing delimiter not required.
551
+
Sps-Service: id=d4f885c5-2196-49c0-ba69-bc70008585ad; name=transform-service // strip out whitespace between delimiters and keys.
552
+
Sps-Service: id=d4f885c5-2196-49c0-ba69-bc70008585ad // permissable, but discouraged, if name is unknown (implementation specific).
553
+
Sps-Service: id=d4f885c5-2196-49c0-ba69-bc70008585ad;name=transform-service;custKey=thing // extending with custom attributes
554
+
555
+
// INCORRECT
556
+
Sps-Service-Id: id=d4f885c5-2196-49c0-ba69-bc70008585ad // incorrect header name
557
+
Sps-Service: id=24 // id must be in format of UUID.
558
+
Sps-Service: id=d4f885c5-2196-49c0-ba69-bc70008585ad;custom-key=hello // attribute keys must be camelCase.
559
+
Sps-Service: id=d4f885c5-2196-49c0-ba69-bc70008585ad;appVersion=1.2.3 // version does not relate to ownership, but rather user-agent.
560
+
Sps-Service: id=d4f885c5-2196-49c0-ba69-bc70008585ad;id=f5f844f3-6177-4474-b845-6d5cd9b00f48 // cannot have duplicate keys, or multiple ids represented.
561
+
Sps-Service: id=d4f885c5-2196-49c0-ba69-bc70008585ad;name=myService // name does not meet pattern requirements with an uppercase letter.
562
+
Sps-Service: id=d4f885c5-2196-49c0-ba69-bc70008585ad,name=myService // HTTP headers are delimited by semicolons when values describe a single entity, not commas (used for lists).
0 commit comments