Book seats on four questionable flights. Practice 409 seat conflicts and overbooking, a booking state machine (confirmed → checked-in → cancelled), 410 Gone for cancelled bookings, If-Match concurrency and idempotent booking.
The Airline API sells seats, which means it is built to be contended: two bookings for the same seat conflict, and flights that have departed are gone rather than merely missing. It is the catalog's only source of 410 Gone, the status most clients treat as a 404 and should not.
Base URL: https://funapi.dev/api/airline/v1 · 9 endpoints · OpenAPI 3.1 spec and Postman collection available. New here? Read the getting started guide.
GET https://funapi.dev/api/airline/v1/flights — List flights, filter by route. No token, no signup:
curl -i https://funapi.dev/api/airline/v1/flights
answers 200 OK with:
{
"total": 4,
"data": [
{
"id": "FN101",
"from": "NYC",
"to": "LON",
"departs": "08:30",
"gate": "A4",
"status": "scheduled",
"seatsTotal": 6,
"seatsFree": 5
},
{
"id": "FN202",
"from": "IST",
"to": "TYO",
"departs": "13:45",
"gate": "B2",
"status": "scheduled",
"seatsTotal": 4,
"seatsFree": 4
},
{
"id": "FN303",
"from": "SFO",
"to": "SYD",
"departs": "21:05",
"gate": "C1",
"status": "cancelled",
"seatsTotal": 4,
"seatsFree": 4
},
{
"id": "FN404",
"from": "AMS",
"to": "REK",
"departs": "06:15",
"gate": "D7",
"status": "boarding",
"seatsTotal": 2,
"seatsFree": 1
}
]
}
where the planes pretend to go
GET /airline/v1/flights — List flights, filter by route · Responds with 200 Link to this endpointGET /airline/v1/flights/{id} — Get one flight · Responds with 200 404 Link to this endpointGET /airline/v1/flights/{id}/seats — Seat map with availability · Responds with 200 404 Link to this endpointGET /airline/v1/flights/{id}/status — Live-ish flight status (random delays) · Responds with 200 404 Link to this endpointa state machine with conflicts
POST /airline/v1/bookings — Book a seat (409 on conflicts & overbooking) (requires Bearer auth) · Responds with 201 400 401 404 409 Link to this endpointGET /airline/v1/bookings/{id} — Get a booking (410 if cancelled) (requires Bearer auth) · Responds with 200 401 404 410 Link to this endpointPUT /airline/v1/bookings/{id}/seat — Change seat (If-Match concurrency) (requires Bearer auth) · Responds with 200 400 401 404 409 412 Link to this endpointPOST /airline/v1/bookings/{id}/checkin — Check in (state machine) (requires Bearer auth) · Responds with 200 401 404 409 Link to this endpointDELETE /airline/v1/bookings/{id} — Cancel a booking (admin only, then 410) (requires Bearer auth) · Responds with 204 401 403 404 409 Link to this endpointLast updated