APIs Overview

Learn about TheMealDB API and TheCocktailDB APIs.

TheCocktailDB API

TheCocktailDB API provides access to an open online database of cocktail recipes. It is a free API used to query a database of hundreds of cocktails. We can search for recipes, images of specific cocktails, ingredients, and much more. It provides the required information as a JSON object.

TheMealDB API

TheMealDB API provides access to an open online database of food recipes. It is free to use and can get us recipes, food details, food names, food images, and more. The data is returned as a JSON object by this API.

The test API key, 1, can be used for authentication purposes when we are using these APIs for development or educational purposes. However, we’ll need to sign up as a PayPal supporter if we want to release our app publicly. Since we’re just learning about these APIs in this course, we’ll keep things simple and use the test API key for authentication.

Fetch recipe for breakfast

Let’s get a glimpse of what we can fetch using this API. The widget below uses hidden code to call an endpoint of TheMealDB API. We retrieve a breakfast recipe in JSON format and print the image, name, and recipe returned.

Press + to interact
fetch_breakfast() # A function that calls the API and prints the fetched image and name