I want to use Google Speech API's asynchronous transcription service. I've uploaded my audio file on Google buckets and I'm trying to use it with the following code (I've removed my key and my filename from the command, everything else is copied).
curl -H "Content-Type: application/json"
--data '{"audio":{"uri":"https://storage.cloud.google.com/<mybucketname>/<filename>"},
"config":{"encoding":"FLAC","sample_rate_hertz":"16000","language_code":"en_US"}}'
https://speech.googleapis.com/v1/speech:longrunningrecognize?key=<mykey>
I get a 400 INVALID_ARGUMENT error telling me "Request contains an invalid argument". What am I doing wrong in my curl request?
Apparently the problem was in my URI. Google has a special way for referencing items in Google buckets, with "gs:" as the prefix.
curl -H "Content-Type: application/json"
--data '{"audio":{"uri":"gs://<mybucketname>/<filename>"},
"config":{"encoding":"FLAC","sample_rate_hertz":"16000","language_code":"en_US"}}'
https://speech.googleapis.com/v1/speech:longrunningrecognize?key=<mykey>
Note that I got a permission error that I could not overcome after I switched to this approach, but I don't think this is related to the way I'm making my curl request anymore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With