liveBook · Manning

User-chosen identifier

As explained in API Design Patterns

A user-chosen identifier is a resource identifier selected by the API consumer rather than generated by the service.

A user-chosen identifier is a resource or request identifier selected by the API consumer instead of generated implicitly by the service. It makes intent explicit, but can complicate creation semantics and should generally be avoided unless the API needs it. section 26.3.1 section 7.3.8

Explicit request deduplication

A create-chat-room request can include an optional requestId. The service can use that client-selected value to recognize an intentional retry, rather than deriving identity from request content. This expresses a deduplication request without silently changing default behavior; expiration means it is not a permanent guarantee against duplicate work. section 26.3.1

Use the pattern deliberately:

  • Accept a user-chosen identifier when clients must explicitly identify a request or address a resource. section 26.3.1 section 7.3.8
  • Avoid using replace as a create operation unless the API accepts client-selected resource identifiers; otherwise creation and replacement outcomes remain ambiguous. section 7.3.8

How API Design Patterns covers it

How deep it goes
Explains motivation, trade-offs, and request shape, but stops short of specifying identifier validation or storage behavior.
Examples
Uses a requestId field on CreateChatRoomRequest and a replace operation addressed by resource.id.
What it assumes
Assumes familiarity with API requests and standard methods while explaining deduplication intent and creation ambiguity.
What you can do after
Designs explicit identifier behavior and recognizes when replace-based creation introduces client-selected resource addresses.
How it connects
Connects request deduplication, caching, retries, create, replace, and resource-oriented APIs.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of API Design Patterns. The section links point to the parts of the book it draws on.