### 3.4.15 豆果菜谱 #### (1)功能说明 豆果美食接入完整的豆果API接口,实现菜谱、标签、场景、食材等多种关键词的搜索,满足用户的各类菜谱需求。 #### (2) 接口说明 **请求方法** * POST **请求地址** * [http://api.ruyi.ai/v1/message](http://api.ruyi.ai/v1/message) **请求参数说明** | 参数名 | 参数类型 | 是否必须 | 参数说明 | | :--- | :--- | :---: | :--- | | q | String | 是 | 自然语言表达,例如“川菜怎么做”| | app\_key | String | 是 | 应用开发者秘钥,注册开发者后台账号,建立虚拟助理后获得 | | user\_id | String | 是 | 用户唯一标识,便于支持个性化语义解析。建议开发者使用 UUID 字符,且不同用户必须用不同的 user\_id,防止意图串。 | #### (3) 返回说明 **返回参数说明** | 名称 | 类型 | 说明 | | :--- | :--- | :--- | | code | Integer | 返回代码 | | msg | String | 返回代码描述 | | parameters | JSON Object | 解析到的实体以及服务说明 | | action | String | 服务的接口名称 | | name | String | 匹配的意图名称 | | result | JSON Object | 接口返回内容 | | outputs | Array | 服务输出结果,微信端使用 type 类型为 wechat 开头的内容;硬件端收到所有内容,依据需求解析使用 | **返回代码说明** | 返回代码 | 错误类型 | 说明 | | :--- | :--- | :--- | | 0/200 | 成功 | 请求成功 | | 400 | 无效请求 | 某些必需参数缺失或参数值错误,详见msg字段 | | 401 | 未授权 | 授权失败,app\_key缺失或错误 | | 403 | 请求被禁止 | 有效请求,但服务拒绝响应,请联系contact@ruyi.ai | | 408 | 请求超时 | 请求响应超时,一般响应时间设置为2000ms以内 | | 429 | 短时间内大量访问 | 短时间内请求数过多 | | 500 | 内部错误 | 服务处理异常 | | 503 | 服务不可用 | 服务异常或正在维护 | #### (4)请求示例 **请求范例** _打开菜谱_ _川菜怎么做_ _打开第一个_ _第二步怎么做_ _退出_ **请求示例** * http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=川菜怎么做 **返回结果** ```json { code: 0, msg: "ok", result: { _text: "川菜怎么做", msg_id: "22e482f9-1428-457c-8d3c-a120e7b5d456", intents: [ { parameters: { pageNum: "3", order: "2", ifMax: "1", keyword1: "川菜", page: "1", any: "", 标签云: "你可以说:第一个,下一批,翻页,我想吃蛋包饭,教我做酸汤肥牛面,肉包子怎么蒸", service: "douguo" }, action: "豆果菜谱搜索", name: "P2关键词搜索_菜名", result: { code: 200, response: { code: "success", msg: "", data: { recipes: [ { id: 202193, name: "鱼香肉丝", img: { s120: "http://i1.douguo.net//upload/caiku/e/f/9/120_ef1b8a39fa93c683e9328ae0d82bf289.jpg", s200: "http://i1.douguo.net//upload/caiku/e/f/9/200_ef1b8a39fa93c683e9328ae0d82bf289.jpg", s300: "http://i1.douguo.net//upload/caiku/e/f/9/300_ef1b8a39fa93c683e9328ae0d82bf289.jpg", s600: "http://i1.douguo.net//upload/caiku/e/f/9/600_ef1b8a39fa93c683e9328ae0d82bf289.jpg", sbase: "http://i1.douguo.net//upload/caiku/e/f/9/ef1b8a39fa93c683e9328ae0d82bf289.jpg", sorigin: "http://i1.douguo.net//upload/caiku/e/f/9/yuan_ef1b8a39fa93c683e9328ae0d82bf289.jpg" }, cookstory: "一直以来,我做菜都会避开那些个经典菜式,觉得经典菜比较大众,我有喜新厌旧的毛病,这个熟悉我的都知道,比较喜欢做那些有新意的菜。所以自己掌厨好几年,居然就是没有尝试过做这道鱼香肉丝。前段时间,小少爷因为在外用餐吃过后特别喜欢,于是回家一个劲的鼓动我做鱼香肉丝,我当然得满足他,于是尝试着做了一次,哪个晓得,这一做就不可收拾了,首先我自己喜欢死了这个菜,其次灰太狼也喜欢上了,结局就是一周内做了三次这道鱼香肉丝,酸、甜、香、鲜,很开胃,味道实在非常的讨巧!大力推荐给各位,一个绝对镇得住场面的家常菜,主妇必学人气菜式之一。", ctime: "2012-12-03 10:04:38", cook_difficulty: "", anthor: "月亮晶晶", anthoricon: "http://tx1.douguo.net/upload/photo/4/9/7/70_u99657481.jpg", major: [ { title: "猪里脊肉", note: "250g" }, { title: "冬笋", note: "一小颗" }, { title: "胡萝卜", note: "小的一根" }, { title: "黑木耳", note: "一小把" }, { title: "葱末", note: "一茶匙" }, { title: "姜末", note: "一茶匙" }, { title: "蒜末", note: "一茶匙" }, { title: "剁椒", note: "一汤匙" }, { title: "水淀粉", note: "适量" } ], minor: [ { title: "料酒", note: "一汤匙" }, { title: "醋", note: "两汤匙" }, { title: "生抽", note: "一汤匙" }, { title: "白糖", note: "一茶匙" }, { title: "香麻油", note: "一茶匙" }, { title: "水", note: "5汤匙" } ], clicks: 10788327, favo_counts: 529762 }, { id: 699488, name: "香辣劲爽的水煮肉片超鲜嫩秘法【家乐上菜,家常有味】", img: { s120: "http://i1.douguo.net//upload/caiku/6/4/c/120_64b997cc9c9089cae229a56cdc67d47c.jpg", s200: "http://i1.douguo.net//upload/caiku/6/4/c/200_64b997cc9c9089cae229a56cdc67d47c.jpg", s300: "http://i1.douguo.net//upload/caiku/6/4/c/300_64b997cc9c9089cae229a56cdc67d47c.jpg", s600: "http://i1.douguo.net//upload/caiku/6/4/c/600_64b997cc9c9089cae229a56cdc67d47c.jpg", sbase: "http://i1.douguo.net//upload/caiku/6/4/c/64b997cc9c9089cae229a56cdc67d47c.jpg", sorigin: "http://i1.douguo.net//upload/caiku/6/4/c/yuan_64b997cc9c9089cae229a56cdc67d47c.jpg" }, cookstory: "最近入秋了,特别想吃肉,可是又不想吃红烧肉那样腻腻的菜~我们那位提议水煮肉片!正好和我意,一想到水煮肉片那辣辣爽爽的感觉,肉片鲜嫩无比的口感,口水都要流下来了,尤其是最后的热油泼上去发出的“嗤”的一声,各种香味爆满~别提多带劲啦~还有外加提下哈~特别感谢家乐鸡粉让肉片如此鲜嫩,感谢豆果网让我有这个机会试用,感谢生活让我有如此多的美食享受~各种爱,各种感恩,各种美味,好幸福呐~~", ctime: "2013-09-20 17:40:30", cook_difficulty: "", anthor: "若雪樱紫1988", anthoricon: "http://tx1.douguo.net/upload/photo/a/b/1/70_u7365116144914308021820.jpg", major: [ { title: "瘦肉", note: "300克" }, { title: "青菜", note: "4颗" }, { title: "金针菇", note: "适量" }, { title: "香干", note: "适量" }, { title: "冬瓜", note: "适量" } ], minor: [ { title: "郫县豆瓣", note: "3汤匙" }, { title: "料酒", note: "1.5汤匙" }, { title: "淀粉", note: "1.5汤匙" }, { title: "家乐鸡粉", note: "1汤匙" }, { title: "盐", note: "1/2茶匙" }, { title: "鸡精", note: "少量" }, { title: "干辣椒", note: "6个" }, { title: "花椒", note: "20粒" }, { title: "葱", note: "适量" }, { title: "生抽", note: "1茶匙" }, { title: "糖", note: "1茶匙" }, { title: "蒜(切末)", note: "4瓣" }, { title: "姜(切末)", note: "5克" }, { title: "胡椒粉", note: "适量" }, { title: "蛋清", note: "半个" } ], clicks: 5645405, favo_counts: 318371 }, { id: 183401, name: "少油的鱼香茄子", img: { s120: "http://i1.douguo.net//upload/caiku/3/e/8/120_3e47a38b819d9d1a97aee4cea0ce4a88.png", s200: "http://i1.douguo.net//upload/caiku/3/e/8/200_3e47a38b819d9d1a97aee4cea0ce4a88.png", s300: "http://i1.douguo.net//upload/caiku/3/e/8/300_3e47a38b819d9d1a97aee4cea0ce4a88.png", s600: "http://i1.douguo.net//upload/caiku/3/e/8/600_3e47a38b819d9d1a97aee4cea0ce4a88.png", sbase: "http://i1.douguo.net//upload/caiku/3/e/8/3e47a38b819d9d1a97aee4cea0ce4a88.png", sorigin: "http://i1.douguo.net//upload/caiku/3/e/8/yuan_3e47a38b819d9d1a97aee4cea0ce4a88.png" }, cookstory: "小时候极不爱吃茄子,一口都不吃。上高中的时候有一次中午老师拖堂,下课之后食堂只有烧茄子了,无奈只能吃这个,用五花肉烧的茄子拌米饭,都快把我给吃哭了,太好吃了,我怎么长这么大了才发现茄子如此美味呢?从此以后茄子便成为我最爱的蔬菜之一了。", ctime: "2012-09-19 20:50:36", cook_difficulty: "配菜(中级)", anthor: "潘潘猫", anthoricon: "http://tx1.douguo.net/upload/photo/b/c/6/70_panpanye193958.jpg", major: [ { title: "茄子", note: "一个" }, { title: "青椒", note: "一个" }, { title: "蒜末", note: "适量" }, { title: "葱末", note: "适量" }, { title: "姜末", note: "适量" } ], minor: [ { title: "郫县辣酱", note: "一勺" }, { title: "醋", note: "1勺" }, { title: "酱油", note: "1/2勺" }, { title: "糖", note: "1/2勺" }, { title: "淀粉", note: "1/2勺" }, { title: "料酒", note: "一勺" } ], clicks: 9061028, favo_counts: 314515 } ] }, page: "1" }, text: "为您找到“川菜”的相关菜谱", type: "dialog" }, outputs: [ { type: "wechat.text", property: { text: "为您找到“川菜”的相关菜谱" } }, { type: "dialog", property: { text: "为您找到“川菜”的相关菜谱", emotion: "calm" } } ], score: "1.0", scoreColor: "c4", is_match: 1, skill_id: "b6c86e82-852f-4e45-b2c0-6a40994f1a75", id: "e290bfd8-9bd6-4600-9877-0ea37ee59628" } ], meta_process_milliseconds: 248 } } ``` **详细参数说明** | 名称 | 类型 | 说明 | | :--- | :--- | :--- | | service | String | 服务名称 | | keyword | String | 识别关键词 | | pageNum | String | 页数 | | page | String | 当前页 | | order | String | 当前顺序 | | ifMax| String | 是否获取主料或辅料。1获取,0不获取 |