我正在尝试使用IBM Bluemix德语STT服务器。在Bluemix环境中,(英语)文档具有与我的身份验证凭据旁边显示的(德语)链接不同的链接。并不奇怪,文档描述的方法告诉我,我没有访问权限。在德语URL上使用该方法告诉我我没有使用正确的请求方法。那么,任何人都知道如何让德国服务器返回我的音频文件的转录?
PS。此链接是正确的方向,但SST问题的解释是针对TTS服务: How can I access IBM speech-to-text api with curl? PS2。我需要德国服务器,因为数据不应该离开国家
美国/全球服务器
curl -X POST -u {username}:{password} --header "Content-Type: audio/flac" --header "Transfer-Encoding: chunked" --data-binary ./audio-file.flac "https://stream.watsonplatform.net/speech-to-text/api/v1/recognize"
返回
{ "code" : 401 , "error" : "Not Authorized" , "description" : "2017-07-21T05:15:17-04:00, Error ERCDPLTFRM-DNLKUPERR occurred when accessing https://stream.watsonplatform.net/speech-to-text/api/v1/recognize, Tran-Id: stream-dp02-872773132 - Invalid UserId and/or Password. Please confirm that your credentials match the end-point you are trying to access. A common error is trying to use credentials from an experimental or beta release against a GA release or vice versa" }
德国服务器
curl -X POST -u {username}:{password}--header "Content-Type: audio/flac" --header "Transfer-Encoding: chunked" --data-binary ./audio-file.flac "https://stream-fra.watsonplatform.net/speech-to-text/api"
响应
{
"error": "Your browser approached me (at /speech-to-text/api) with the method \"POST\". I only allow the methods HEAD, GET here.",
"code": 405,
"code_description": "Method Not Allowed"
答案 0 :(得分:0)
感谢data_henrik为我提供了正确的建议。请随时将您的评论作为答案写下来,以便我接受。
答:
而不是
curl -X POST -u {username}:{password}--header "Content-Type: audio/flac" --header "Transfer-Encoding: chunked" --data-binary ./audio-file.flac "https://stream-fra.watsonplatform.net/speech-to-text/api"
我应该用
curl -X POST -u {username}:{password} --header "Content-Type: audio/flac" --data-binary "@audio-file.flac" "https://stream-fra.watsonplatform.net/speech-to-text/api/v1/recognize"
区别:链接末尾的v1 /识别。