0
votes

I'm trying to use the ibm watson speech to text service. Using Curl and the appropriate credentials i'm getting an error and don't understand why. I'm new to this so i need some help

I'm using this command-lines to get the text out of an audio file:

 curl -u username:password -X POST \ --header "Content-Type: audio/flac" \ --header "Transfer-Encoding: chunked" \ --data-binary @/tmp/0001.flac \ "https://stream.watsonplatform.net/speech-to-text/api/v1/recognize?continuous=true"

and i'm getting this error:

curl: (6) Could not resolve host: --header curl: (6) Could not resolve host: Content-Type curl: (6) Could not resolve host: --header curl: (6) Could not resolve host: Transfer-Encoding curl: (6) Could not resolve host: --data-binary curl: (6) Could not resolve host: curl: (1) Protocol https not supported or disabled in libcurl

does anybody know what i'm doing wrong?

1
The \ --header escapes the space before --header so it's not recognized as an option. - Kenney
i don't follow.. you're saying i should eliminate the \? - Angel G Garcia Almodovar
Indeed. It's possible that the original commandline was spanning multiple lines; in that case the \ would mean to append the next line. But when it's not the last character in the line, it escapes the next character, changing the --header parameter to ` --header` (with an extra space). It doesn't start with -- and is seen as the hostname rather than an option. - Kenney
dude you're a life saver. it worked. i did it earlier but i guess i left an extra space or something. but now it worked. thanks! - Angel G Garcia Almodovar
Awesome ;-) You're welcome! - Kenney

1 Answers

2
votes

Remove the / from the curl command, we use them in the API Reference to better display the curl commands but they don't work in Windows.

curl -u username:password -X POST  
--header "Content-Type: audio/flac"  
--header "Transfer-Encoding: chunked"
--data-binary @/tmp/0001.flac 
"https://stream.watsonplatform.net/speech-to-text/api/v1/recognize?continuous=true"

The command will work in unix based system like Ubuntu or Mac.