How I can convert the following cURL
into an ajax
REST call?
curl -u "{username}":"{password}" \
-H "content-type: audio/wav" \
--data-binary @"/path/to/file.wav" \
"https://stream.watsonplatform.net/speech-to-text/api/v1/recognize"
I added few of it to below ajax call, I do no know how to add the rest of it, specially the part mentioned in -H
and --data-binary @
function restCall()
{
$.ajax
({
type: "GET",
url: "https://stream.watsonplatform.net/speech-to-text/api/v1/recognize",
dataType: 'json',
username: "xxxx",
password: "xxxx",
success: function (data){
alert(JSON.stringify(data));
}
});
}