Get a Random Meal
Learn how we can get a random meal recipe using this API.
We'll cover the following
Sometimes, the user might not know what to cook. This is where we can use this endpoint to give the user the recipe for a random meal. The base URI of this endpoint is https://www.themealdb.com/api/json/v1/1/random.php
.
Query parameter
This endpoint does not require any query parameters.
Search for the recipe of a random meal
The code below shows how we can call this endpoint to get the recipe for a random meal.
import jsonimport requestsurl=('https://www.themealdb.com/api/json/v1/1/random.php')response = requests.request("GET", url).json()print(json.dumps(response, indent=4))
We’ll get the following information in response:
- Ingredients required
- Instructions to create a meal
- Amounts of ingredients
- Name of the meal
- Database ID
- Category
- Cuisine
- Link for an image of the meal
- Video
- Database tags
- Last modified date
- License