Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Bing Speech example with Curl

First off, I don't really know what I'm doing, so I apologize for the stupid question... just trying to follow the instructions here: https://www.microsoft.com/cognitive-services/en-us/Speech-api/documentation/GetStarted/GetStarted-cURL

using cURL on Windows and entering this:

curl -v -X POST "https://speech.platform.bing.com/recognize?scenarios=ulm&appid=D4D52672-91D7-4C74-8AD8-42B1D98141A5&locale=en-US&device.os=windows&version=3.0&format=json&instanceid=e8ef8f76-2318-45d4-ac04-b73362ac61ec&requestid=73346a62-51fb-4aad-882b-9e5cd4198f57" -H 'Authorization: Bearer JWT'-H 'Content-type: audio/wav; codec="audio/pcm"; samplerate=16000' --data-binary @bing2.wav

Here's the output... any clues as to what I'm doing wrong would be greatly appreciated:

*  SSL certificate verify ok.
> POST /recognize?scenarios=ulm&appid=D4D52672-91D7-4C74-8AD8-
42B1D98141A5&local
e=en-US&device.os=windows&version=3.0&format=json&instanceid=e8ef8f76-2318-    45d4-
ac04-b73362ac61ec&requestid=73346a62-51fb-4aad-882b-9e5cd4198f57 HTTP/1.1
> Host: speech.platform.bing.com
> User-Agent: curl/7.50.0
> Accept: */*
> Content-Length: 314438
> Content-Type: application/x-www-form-urlencoded
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 403 Forbidden
< Content-Length: 0
< Server: Microsoft-IIS/8.5
< X-MSEdge-Ref: Ref A: 3BA3FD7E454246D69D3B1E6C436F0261 Ref B:     
8CD198CC061DC0914
B02FDF95CFEDBD6 Ref C: Sun Jan  8 15:06:41 2017 PST
< Date: Sun, 08 Jan 2017 23:06:41 GMT
<
* Connection #0 to host speech.platform.bing.com left intact
Note: Unnecessary use of -X or --request, POST is already inferred.
* Rebuilt URL to: Bearer/
* Could not resolve host: Bearer
* Closing connection 1
curl: (6) Could not resolve host: Bearer
Note: Unnecessary use of -X or --request, POST is already inferred.

Thanks in advance!

like image 406
AnarchyJim Avatar asked Oct 30 '22 14:10

AnarchyJim


1 Answers

If you format the command line properly it should work.

You miss the space before -H 'Content-type..., so that quote before -H is not properly processed. You also need to substitute the token you received on previous step properly after Bearer, not just put JWT.

like image 99
Nikolay Shmyrev Avatar answered Jan 02 '23 21:01

Nikolay Shmyrev