The guilds join in

Exercise 4 of 6 in chapter 12 · 320 XP · 5 objectives checked by tests

Topics covered: JSON API#[MapRequestPayload]HTTP status codesStateless firewall

The guilds want their story nights too. They already have their magic scrolls to book a table: now they want to browse the story nights and sign up their members, without going through the website.

The specifications

GET /api/story-nights (no seal)

The upcoming story nights, from the nearest to the furthest, in JSON (the keys stay French: titre = title, conteur = storyteller, debut = start, places = seats, placesRestantes = seats left, complet = full):

[
  {
    "id": 2,
    "titre": "The Fall of Gondolin",
    "conteur": "Galadriel",
    "debut": "2026-10-20T20:30:00+00:00",
    "places": 12,
    "placesRestantes": 8,
    "complet": false
  }
]

POST /api/story-nights/{id}/signups (with a guild's seal: Authorization: Bearer …)

The body: {"nom": "Legolas", "email": "legolas@mirkwood.me", "personnes": 2}.

Situation Response
sign-up accepted 201, with the sign-up (id, nom, personnes) and the updated story night (soiree, in the list's format); the scroll goes out, just like on the website
not enough seats 409, with Not enough seats: only 1 left.
invalid data, or address already signed up 422, with the rule's message
no seal, or a fake one 401
unknown story night 404

In every rejected case, nothing is saved.

The preview's Requests tab has ready-to-use examples, with the Silver Blades' seal.