请求Google Cloud Speech API请求时出错

时间:2017-04-06 16:09:12

标签: google-cloud-platform google-cloud-speech

当我向Google Cloud Speech API发出请求时,我收到此错误: “错误”:{     “代码”:400,     “message”:“请求包含无效参数。”,     “status”:“INVALID_ARGUMENT

我的curl命令如下所示: curl -s -k -H“Content-Type:application / json”-H“授权:Bearer xxxxxxx”\ https://speech.googleapis.com/v1beta1/speech:syncrecognize -d @ sync-request.json

和我的配置文件是这样的:

      {
  'config': {
      'encoding':'FLAC',
      'sampleRate': 16000,
      'languageCode': 'de-DE'
  },
  'audio': {
      'uri':'https://storage.googleapis.com/project_name/xxxx_Ger16.flac'
  }
}

请求中缺少什么或无效?感谢。

1 个答案:

答案 0 :(得分:6)

收到的错误消息表明您在JSON请求正文中提供的属性无效。正如您在评论中确认的那样,云存储资源的audio.uri值应与 gs:// bucket_name / object_name 模式匹配。

RecognitionAudio类型的请求正文中的audio对象。这方面的文件证实了你的发现。