Search code examples
curlibm-cloudspeech-to-text

cURL no url specified


I am following this tutorial to set up a speech to text service in IBM Bluemix: https://www.ibm.com/watson/developercloud/doc/speech-to-text/tutorial.shtml

I have installed and tested the prerequisites, but somehow I get an error when I try to enter:

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

I got following error:

curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information

I've tested the username and password when I was directly accessing the url and it worked. The path I've entered for the audio file is also correct since I just copied it.

Does anyone know how to fix this? Thanks in advance! :)


Solution

  • You are missing the escapes for new lines. Try something like this:

    curl -X POST -u "myusername":"mypassword" \
    --header "Content-Type: audio/flac" \
    --data-binary "@audio-file1.flac" \
    --data-binary "@audio-file2.flac" \
    "https://stream.watsonplatform.net/speech-to-text/api/v1/recognize?timestamps=true&word_alternatives_threshold=0.9&keywords=%22colorado%22%2C%22tornado%22%2C%22tornadoes%22&keywords_threshold=0.5&continuous=true"
    

    Sample Audio Files