CoffeeWorld

Discover the art of coffee making and dive into the world of coffee specialties

REST API

Quickstart

  1. Make a GET request to https://api.coffeeworld.info/api/coffee
  2. Receive JSON data with all coffee variations
  3. Filter specific coffee with ?id=espresso

Endpoints

GET/api/coffee

All coffee specialties

Returns an array of all coffee variations

Response: [{ id, name, ... }]
GET/api/coffee?id=:name

Single coffee specialty

Returns a single coffee object

Response: { id, name, ... }

Response Format

type Coffee = {
  id: string;          // Unique identifier
  name: string;        // Display name
  origin: string;      // Country of origin
  ratio?: string;      // Coffee to water ratio
  ingredients: {       // Required ingredients
    [key: string]: {
      min: number;     // Minimum amount in ml
      max: number;     // Maximum amount in ml
    }
  };
  cold?: boolean;      // Served cold flag
  caffeine: {         // Caffeine content
    min: number;      // Minimum in mg
    max: number;      // Maximum in mg
  };
  origin: string;      // Country of origin
}

Code Examples

JavaScript (Fetch)

fetch('https://api.coffeeworld.info/api/coffee?id=freddo')
  .then(res => res.json())
  .then(coffee => console.log(coffee));

JavaScript (Axios)

const response = await axios.get(
  'https://api.coffeeworld.info/api/coffee?id=freddo'
);
console.log(response.data);

curl

curl https://api.coffeeworld.info/api/coffee?id=freddo

Example Response

{
  "id": "freddo",
  "name": "Caffè Freddo",
  "ingredients": {
    "espresso": {
      "min": 18,
      "max": 18
    },
    "water": {
      "min": 60,
      "max": 60
    },
    "sugar": {
      "min": 10,
      "max": 10
    }
  },
  "cold": true,
  "caffeine": {
    "min": 58,
    "max": 64
  },
  "origin": "Italy"
}