System Design Atlas

Service marketplace

04 / 10Worked example

Interfaces

What happens when K-17 is reused with a changed offerId?

Key, version and result are part of the API contract.

Starting point Compare the key and request fingerprint.

Assumptions for the example case

Illustrative design: 10,000 searches and 1,000 new requests per day, averaging five offers per request; a peak of 25 searches/s; and 20 concurrent award attempts against the same request. Payment, service delivery and warranty are outside the scope.

Interfaces

Four contracts connect roles and the system.

API contracts

  1. POST/requests/A-17/offers

    Submit an offer you own

    Input
    Provider, content, requestKey
    Result
    201 O-17 submitted
    Retry behaviour
    Identical content returns O-17; altered content produces a conflict.
  2. POST/requests/A-17/award

    Award a valid offer

    Input
    O-17, expectedVersion 4, K-17
    Result
    A-17 awarded and L-17
    Retry behaviour
    An identical retry returns the original result.
  3. GET/requests/A-17

    Read a request you own

    Input
    Authorised identity
    Result
    Version and visible offers
    Retry behaviour
    Safely repeatable

Terms in this step

Idempotency key
Binds a retry to the same business command.

Try it yourself

Decide between replay and conflict.

A hint for your attempt

Only identical content may receive the old result.

Compare with a possible solution
Identical
Deliver L-17 again.
Changed
idempotency_conflict.

Apply to your project

Define the fingerprint for a booking.

Next, model identities and states.