TheMealDB
餐食食谱
- 认证方式
- API Key
- HTTPS
- Yes
- CORS
- Yes
- 分类
- 餐饮
简介
TheMealDB 是开放、社区维护的菜谱数据库:带配料+计量的食谱、分步做法、照片和 YouTube 视频,按分类(牛肉、鸡肉、海鲜、甜点……)和地区(英式、意式、墨西哥……)组织。非常适合菜谱应用、膳食计划和厨房显示屏项目。
快速开始
随机菜品——免费层的公开测试 key 就是 1:
curl "https://www.themealdb.com/api/json/v1/1/random.php"
按名称搜索:
curl "https://www.themealdb.com/api/json/v1/1/search.php?s=pie"
按 ID 查询:
curl "https://www.themealdb.com/api/json/v1/1/lookup.php?i=52802"
按分类、地区或配料筛选:
curl "https://www.themealdb.com/api/json/v1/1/filter.php?c=Seafood"
curl "https://www.themealdb.com/api/json/v1/1/filter.php?a=Italian"
curl "https://www.themealdb.com/api/json/v1/1/filter.php?i=chicken_breast"
构建筛选器用的列表:
curl "https://www.themealdb.com/api/json/v1/1/list.php?c=list" # 分类
curl "https://www.themealdb.com/api/json/v1/1/list.php?a=list" # 地区
curl "https://www.themealdb.com/api/json/v1/1/list.php?i=list" # 配料
认证方式
- 免费层使用共享测试 key
1(在 URL 路径中:/api/json/v1/1/...)。 - 生产环境请在官网注册免费账号,获取个人密钥(
/api/json/v2/<YOUR_KEY>/...)。
速率限制与注意事项
- 免费/测试层有限流(大约每 2 秒 1 次请求),且无 SLA 保证。
- 菜谱数据由社区贡献——重要用途请核对做法。
- 每个配料都带计量(
strIngredient1+strMeasure1成对)——非常适合结构化菜谱渲染。
常见问题
TheMealDB 免费吗?
是的——免费层用公开测试 key 1;注册用户可获个人免费密钥。
为什么 key 是 “1”? 那是免费层的共享公开测试 key。生产环境请注册获取自己的密钥。
可以在浏览器直接调用吗? 可以——已启用 CORS。
餐饮 分类更多
| API | Auth | HTTPS | CORS | |
|---|---|---|---|---|
| BaconMockup Resizable bacon placeholder images | No auth | Yes | Yes | ↗ |
| Chomp Data about various grocery products and foods | API Key | Yes | Unknown | ↗ |
| Coffee Random pictures of coffee | No auth | Yes | Unknown | ↗ |
| Edamam nutrition Nutrition Analysis | API Key | Yes | Unknown | ↗ |
| Edamam recipes Recipe Search | API Key | Yes | Unknown | ↗ |