Semicolony ELI5 · comic

What an API is.

A restaurant menu: you order from a set list, and the kitchen handles the rest.

  1. Can I just… go in?
    kitchen no entry
    1

    You want something from another program — but you cannot just walk into its kitchen.

  2. MENU getWeathergetUsersendMail a set list of allowed asks
    2

    It hands you a menu instead: the fixed list of requests it agrees to accept.

  3. Weather for London, please.
    getWeather("London") a specific, allowed order
    3

    You place a specific, allowed order — that is a request.

  4. the door well-formed? key valid? in.
    4

    The door checks it: well-formed? are you allowed? (often via an API key).

  5. the kitchen does its thing
    5

    Behind the wall the kitchen does whatever it does — you never see how.

  6. Exactly what I asked for.
    { "temp": 14,"sky": "rain" } a tidy answer your code reads
    6

    Back comes a tidy, structured plate (usually JSON) your code can read.

Order from the menu; the kitchen does the work and sends back a plate. (Bit just wants the weather.)
Semicolony semicolony.dev/eli5/what-is-an-api/comic
← All ELI5 explainers