6

当我向 Google Cloud Speech API 发出请求时出现此错误:"error": { "code": 400, "message": "Request contains an invalid argument.", "status": "INVALID_ARGUMENT

我的 curl 命令如下所示: curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer xxxxxxx" \ https://speech.googleapis.com/v1beta1/speech:syncrecognize -d @同步请求.json

我的配置文件是这样的:

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

请求中缺少什么或无效的内容?谢谢。

4

1 回答 1

7

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

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

于 2017-04-28T15:16:18.143 回答