example-data.com
Menu
Browse docs and collections

Overview

flights / #252

May
18
Tue

British Airways BA7121

7:20 PM – 10:40 PM

ORD → MAD

From USD 1252.89

Component variants

Related

Referenced by

Request

curl example

curl -sS \
  "https://example-data.com/api/v1/flights/252" \
  -H "Accept: application/json"

JavaScript example

const res = await fetch(
  "https://example-data.com/api/v1/flights/252"
);
const flight = await res.json();

TypeScript example

// Download once: mkdir -p types && curl -o types/flights.d.ts https://example-data.com/types/flights.d.ts
import type { Flight } from "./types/flights";

const res = await fetch(
  "https://example-data.com/api/v1/flights/252"
);
const flight = (await res.json()) as Flight;

Python example

import requests

res = requests.get(
    "https://example-data.com/api/v1/flights/252"
)
flight = res.json()

Response

{
  "id": 252,
  "flightNumber": "BA7121",
  "airline": "British Airways",
  "departureAirport": "ORD",
  "arrivalAirport": "MAD",
  "departureAt": "2027-05-18T19:20:57.690Z",
  "arrivalAt": "2027-05-18T22:40:57.690Z",
  "durationMinutes": 200,
  "status": "boarding",
  "priceFrom": 1252.89,
  "currency": "USD",
  "createdAt": "2027-03-28T19:20:57.690Z"
}