首页 文章

请求Google Cloud Speech API请求时出错

提问于
浏览
6

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

我的curl命令如下所示:curl -s -k -H "Content-Type: application/json" -H "Authorization: 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 回答

  • 4

    收到的错误消息表明您在评论中确认了一个属性, Cloud 存储资源的 audio.uri 值应与模式 gs://bucket_name/object_name 匹配 .

    RecognitionAudio类型的请求正文中的 audio 对象 . 相关文档证实了您的发现 .

相关问题