# 获取语音识别结果
接口应在服务器端调用,不可在前端(小程序、网页、APP等)直接调用,具体可参考接口调用指南
接口英文名:queryRecoResultForText
本接口用于查询语音转文字结果
# 1. 调用方式
# HTTPS 调用
POST https://api.weixin.qq.com/cgi-bin/media/voice/queryrecoresultfortext?access_token=ACCESS_TOKEN&voice_id=VOICE_ID&lang=LANG
# 云调用
- 本接口不支持云调用
# 第三方调用
- 本接口不支持第三方平台调用。
# 2. 请求参数
# 查询参数 Query String parameters
参数名 | 类型 | 必填 | 示例 | 说明 |
---|---|---|---|---|
access_token | string | 是 | ACCESS_TOKEN | 接口调用凭证,可使用 access_token |
voice_id | string | 是 | xxxxxx | 语音唯一标识 |
lang | string | 否 | zh_CN | 语言,zh_CN 或 en_US,默认中文 |
# 请求体 Request Payload
无
# 3. 返回参数
# 返回体 Response Payload
参数名 | 类型 | 说明 |
---|---|---|
result | string | 识别结果 |
# 4. 注意事项
添加完文件之后10s内调用这个接口
# 5. 代码示例
请求示例
https://api.weixin.qq.com/cgi-bin/media/voice/queryrecoresultfortext?access_token=ACCESS_TOKEN&voice_id=xxxxxx&lang=zh_CN
返回示例
{
"result": "xxxxxxxxxxxxxxxxxx"
}
# 6. 错误码
以下是本接口的错误码列表,其他错误码可参考 通用错误码
错误码 | 错误描述 | 解决方案 |
---|---|---|
-1 | system error | 系统繁忙,此时请开发者稍候再试 |
40001 | invalid credential access_token isinvalid or not latest | 获取 access_token 时 AppSecret 错误,或者 access_token 无效。请开发者认真比对 AppSecret 的正确性,或查看是否正在为恰当的公众号调用接口 |
# 7. 适用范围
本接口在不同账号类型下的可调用情况:
小程序 | 公众号 | 服务号 | 小游戏 | 移动应用 |
---|---|---|---|---|
✔ | ✔ | ✔ | ✔ | ✔ |
- ✔:该账号可调用此接口
- 其他未明确声明的账号类型,如无特殊说明,均不可调用此接口;