简体   繁体   中英

“error”: { “code”: 400, “message”: “RecognitionAudio not set.”, “status”: “INVALID_ARGUMENT” } }

I want to send request http POST to Cloud Speech API with editor Cloud Shell through this command →

curl -s -X POST -H "Content-Type: application/json" --data-binary @request.json \
"https://speech.googleapis.com/v1/speech:recognize?key=AIzaSyBZMZwv1-WLSMG-OBJiaDQ6Q9oYEff5vEo"

I am following the official tutorial https://codelabs.developers.google.com/codelabs/cloud-speech-intro/index.html?index=..%2F..index#2 , but when I run the command in the editor, the response is this →

 {
  "error": {
    "code": 400,
    "message": "RecognitionAudio not set.",
    "status": "INVALID_ARGUMENT"
  }
}

The code that I wrote in " request.json " file is this one →

{
  "config": {
      "encoding":"FLAC",
      "languageCode": "en-US",
  },
  "audio": {
      "uri":"gs://cloud-samples-tests/speech/brooklyn.flac"
  }
}

我在执行curl命令的文件夹中没有request.json文件时收到您提到的错误。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM