Airline API

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.

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.

flights

where the planes pretend to go

bookings

a state machine with conflicts

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.

What you can practise here

Example request and response

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

Response: 200 OK

{
  "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
    }
  ]
}

Open and run this endpoint

All 55 mock REST APIs

Use this response elsewhere

Last updated