### 3.4.13 每日英语 #### (1)功能说明 当用户需要英语语录时,可随机返回一句英语语录(含中文翻译)。 #### (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: "6ab95749-5667-4a4d-be7a-cbb3da4eb8b1", intents: [ { parameters: { count: "10", showapi_appid: "39740", showapi_sign: "a1f168bb4fc94691aa83da5a8638a1dc", service: "Daily English" }, action: "每日英语", name: "每日英语", result: { code: 200, response: { showapi_res_code: 0, showapi_res_error: "", showapi_res_body: { ret_code: 0, ret_message: "Success", data: [ { english: "The most known person,the warmest partner.", chinese: "最懂的人,最暖的伴。" }, { english: "In our life we are laughing more happily than anybody else.But when the crowd dissipates,we feel much more lonely than anybody else.", chinese: "生活中我们笑得比谁都开心,可是当所有人潮散去的时候,我们比谁都落寂。" }, { english: "Sometimes all I need is someone to hug me tight and refuse to let me go until I feel all better.", chinese: "有时候,只是想有个人抱紧我不放手,直到我的心情真的好起来。" }, { english: "Brief is life, but love is long.", chinese: "生命虽短,爱却绵长。" }, { english: "Love is like sentence spell always let people willingly addictions", chinese: "爱情像句咒语 总让人甘心沉迷。" }, { english: "A friend who betray you in the end, is never your friend from the beginning.", chinese: "最终背叛你的朋友,其实一开始就不是你的朋友。" }, { english: "I wouldn't say love, but I said is true.", chinese: "我不会说情话,但我说的都是真心话。" }, { english: "Something you will realize only when you do it,when you make mistakes or when you grow up.", chinese: "有些事,做了才知道。有些事,错了才知道。有些事,长大了才知道。" }, { english: "Back to the past, return not anymore at the beginning.", chinese: "回得了过去,回不了当初。" }, { english: "Apologizing does not always mean you are wrong & the other person is right. It just means you value your relationship more than your ego.", chinese: "道歉并不总是代表我承认自己错了,只能说,我在乎我们的关系,比我自身还在乎。" } ] } }, text: "英文语录来啦!I wouldn't say love, but I said is true.我不会说情话,但我说的都是真心话。你可以试试“再来一个”哦", type: "dialog" }, outputs: [ { type: "wechat.text", property: { text: "英文语录来啦!Apologizing does not always mean you are wrong & the other person is right. It just means you value your relationship more than your ego.道歉并不总是代表我承认自己错了,只能说,我在乎我们的关系,比我自身还在乎。你可以试试“再来一个”哦" } }, { type: "dialog", property: { text: "英文语录来啦!Apologizing does not always mean you are wrong & the other person is right. It just means you value your relationship more than your ego.道歉并不总是代表我承认自己错了,只能说,我在乎我们的关系,比我自身还在乎。你可以试试“再来一个”哦", emotion: "positive" } } ], score: "1.0", scoreColor: "c4", is_match: 1, id: "4317d377-5bd2-4b81-91a5-d5f240658a40" } ], meta_process_milliseconds: 277 } } ``` **详细参数说明** | 名称 | 类型 | 说明 | | :--- | :--- | :--- | | service | String | 服务名称 |