Advertisement
rowntreerob

ibm watson speech-api sample calls (interim_results=true)

Feb 14th, 2015
724
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.83 KB | None | 0 0
  1. Note that call #3 is the observer that goes in "100 Continue" state type of suspense until such time as call #4 is POSTED. Then call #3 is the observer of interim results generated by the server's consumption of the mic's streams bytes POSTED in #4. Calls 1 and 2 for session create, session init()
  2.  
  3. ==== CALL 1 ====
  4. curl -v -X POST -k "https://gateway.watsonplatform.net:8443/speech-to-text-beta/api/v1/sessions" -u d3b3:l7Yo -d ""
  5.  
  6. * About to connect() to gateway.watsonplatform.net port 8443 (#0)
  7. * Trying 23.246.237.54...
  8. * connected
  9. * Connected to gateway.watsonplatform.net (23.246.237.54) port 8443 (#0)
  10. * successfully set certificate verify locations:
  11. * CAfile: /etc/ssl/certs/ca-certificates.crt
  12. CApath: none
  13. * SSLv3, TLS handshake, Client hello (1):
  14.  
  15. * SSL connection using AES256-SHA
  16. * Server certificate:
  17. * subject: C=US; ST=New York; L=Armonk; O=International Business Machines Corporation; CN=gateway.watsonplatform.net
  18. * start date: 2014-09
  19. * expire date: 2017-09
  20. * subjectAltName: gateway.watsonplatform.net matched
  21. * issuer: C=US; O
  22. * SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
  23. * Server auth using Basic with user 'ef38e'
  24. > POST /speech-to-text-beta/api/v1/sessions HTTP/1.1
  25. > Authorization: Basic ZTM5ZTA2ZTItZDM4Ny00MTBlLWE3MTctZDNiM2ZiM2VmMzhlOkJuam5wNGlGbDdZbw==
  26. > User-Agent: curl/7.28.1-DEV
  27. > Host: gateway.watsonplatform.net:8443
  28. > Accept: */*
  29. > Content-Length: 0
  30. > Content-Type: application/x-www-form-urlencoded
  31. >
  32. < HTTP/1.1 201 Created
  33. < X-Backside-Transport: OK OK
  34. < Connection: Keep-Alive
  35. < Transfer-Encoding: chunked
  36. < Server: Apache-Coyote/1.1
  37. < Date: Sun, 15 Feb 2015 02:01:22 GMT
  38. < Set-Cookie: SESSIONID=c70affb05d39780f251f976bb1dc895c8047962 ***** save this value for successive calls ****
  39. < X-Zuul: zuul
  40. < X-Zuul-instance: unknown
  41. < X-Zuul-Filter-Executions: Routing[SUCCESS][1ms], ParseHostFilter[SUCCESS][0ms], PreDecoration[SUCCESS][0ms], ZuulNFRequest[SUCCESS][7ms]
  42. < X-Originating-URL: https://gateway.watsonplatform.net:8443/speech-to-text-beta/api/v1/sessions
  43. < Content-Type: application/json;charset=utf-8
  44. < X-Client-IP: 108.192.16.200
  45. < X-Global-Transaction-ID: 6228039
  46. <
  47. {
  48. "new_session_uri": "https://gateway.watsonplatform.net:8443/speech-to-text-beta/api/v1/sessions/c70affb05d39780f251f976bb1dc895c",
  49. "recognize": "https://gateway.watsonplatform.net:8443/speech-to-text-beta/api/v1/sessions/c70affb05d39780f251f976bb1dc895c/recognize",
  50. "session_id": "c70affb05d39780f251f976bb1dc895c",
  51. "observe_result": "https://gateway.watsonplatform.net:8443/speech-to-text-beta/api/v1/sessions/c70affb05d39780f251f976bb1dc895c/observeResult",
  52. "recognizeWS": "wss://gateway.watsonplatform.net:8443/speech-to-text-beta/api/v1/sessions/c70affb05d39780f251f976bb1dc895c/recognize"
  53. *
  54.  
  55.  
  56. ==== CALL 2 ==== Note cookie session != Path/sessionId
  57.  
  58. curl -v -X GET -k --header "Cookie: SESSIONID=c70affb05d39780f251f976bb1dc895c8047962" https://gateway.watsonplatform.net:8443/speech-to-text-beta/api/v1/sessions/c70affb05d39780f251f976bb1dc895c/recognize -u ef38e:l7Yo
  59.  
  60. {
  61. "session": {
  62. "recognize": "https://gateway.watsonplatform.net:8443/speech-to-text-beta/api/v1/models/WatsonModel/sessions/c70affb05d39780f251f976bb1dc895c/recognize",
  63. "state": "initialized",
  64. "observe_result": "https://gateway.watsonplatform.net:8443/speech-to-text-beta/api/v1/models/WatsonModel/sessions/c70affb05d39780f251f976bb1dc895c/observeResult",
  65. "model": "https://gateway.watsonplatform.net:8443/speech-to-text-beta/api/v1/models/WatsonModel",
  66. "recognizeWS": "wss://gateway.watsonplatform.net:8443/speech-to-text-beta/api/v1/models/WatsonModel/sessions/c70affb05d39780f251f976bb1dc895c/recognize"
  67. }
  68.  
  69. ==== CALL 3 =====
  70. curl -v -X GET -k --header "Cookie: SESSIONID=c70affb05d39780f251f976bb1dc895c8047962" "https://gateway.watsonplatform.net:8443/speech-to-text-beta/api/v1/models/WatsonModel/sessions/c70affb05d39780f251f976bb1dc895c/observeResult?interim_results=true" -u f38e:l7Yo
  71.  
  72. * About to connect() to gateway.watsonplatform.net port 8443 (#0)
  73. * Trying 23.246.237.54...
  74. * connected
  75. * Connected to gateway.watsonplatform.net (23.246.237.54) port 8443 (#0)
  76. * successfully set certificate verify locations:
  77. * CAfile: /etc/ssl/certs/ca-certificates.crt
  78. CApath: none
  79.  
  80. * SSL connection using AES256-SHA
  81. * Server certificate:
  82. * subject: C=US; ST=New York; L=Armonk; O=International Business Machines Corporation; CN=gateway.watsonplatform.net
  83. * start date: 2014-09
  84. * expire date: 2017-09
  85. * subjectAltName: gateway.watsonplatform.net matched
  86. * issuer: C=US; O
  87. * SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
  88. * Server auth using Basic with user 'f38e'
  89. > GET /speech-to-text-beta/api/v1/models/WatsonModel/sessions/c70affb05d39780f251f976bb1dc895c/observeResult?interim_results=true HTTP/1.1
  90. > Authorization: Basic ZTM5ZTA2ZTItZDM4Ny00MTBlLWE3MTctZDNiM2ZiM2VmMzhlOkJuam5wNGlGbDdZbw==
  91. > User-Agent: curl/7.28.1-DEV
  92. > Host: gateway.watsonplatform.net:8443
  93. > Accept: */*
  94. > Cookie: SESSIONID=c70affb05d39780f251f976bb1dc895c8047962
  95. >
  96. < HTTP/1.1 200 OK
  97. < X-Backside-Transport: OK OK
  98. < Connection: Keep-Alive
  99. < Transfer-Encoding: chunked
  100. < Server: Apache-Coyote/1.1
  101. < Date: Sun, 15 Feb 2015 00:11:09 GMT
  102. < Last-Modified: Sun, 15 Feb 2015 00:06:32 GMT
  103. < Content-Disposition: inline; filename="result.json"
  104. < X-Zuul: zuul
  105. < X-Zuul-instance: unknown
  106. < X-Zuul-Filter-Executions: Routing[SUCCESS][0ms], ParseHostFilter[SUCCESS][0ms], PreDecoration[SUCCESS][0ms], ZuulHostRequest[SUCCESS][68380ms]
  107. < X-Originating-URL: https://gateway.watsonplatform.net:8443/speech-to-text-beta/api/v1/models/WatsonModel/sessions/c70affb05d39780f251f976bb1dc895c/observeResult?interim_results=true
  108. < Content-Type: application/json
  109. < X-Client-IP: 108.192.16.200
  110. < X-Global-Transaction-ID: 170534293
  111. <
  112. {
  113. "results": [
  114. {
  115. "alternatives": [
  116. {
  117. "transcript": "ha "
  118. }
  119. ],
  120. "final": false
  121. }
  122. ],
  123. "result_index": 0
  124. }{
  125. "results": [
  126. {
  127. "alternatives": [
  128. {
  129. "transcript": "harley "
  130. }
  131. ],
  132. "final": false
  133. }
  134. ],
  135. "result_index": 0
  136. }{
  137. "results": [
  138. {
  139. "alternatives": [
  140. {
  141. "transcript": "harley how "
  142. }
  143. ],
  144. "final": false
  145. }
  146. ],
  147. "result_index": 0
  148. }{
  149. "results": [
  150. {
  151. "alternatives": [
  152. {
  153. "transcript": "harley how weird "
  154. }
  155. ],
  156. "final": false
  157. }
  158. ],
  159. "result_index": 0
  160. }{
  161. "results": [
  162. {
  163. "alternatives": [
  164. {
  165. "transcript": "harley how were you "
  166. }
  167. ],
  168. "final": false
  169. }
  170. ],
  171. "result_index": 0
  172. }{
  173. "results": [
  174. {
  175. "alternatives": [
  176. {
  177. "transcript": "harley how are you "
  178. }
  179. ],
  180. "final": false
  181. }
  182. ],
  183. "result_index": 0
  184. }{
  185. "results": [
  186. {
  187. "alternatives": [
  188. {
  189. "transcript": "harley how are you we have "
  190. }
  191. ],
  192. "final": false
  193. }
  194. ],
  195. "result_index": 0
  196. }{
  197. "results": [
  198. {
  199. "alternatives": [
  200. {
  201. "transcript": "harley how are you we have to "
  202. }
  203. ],
  204. "final": false
  205. }
  206. ],
  207. "result_index": 0
  208. }{
  209. "results": [
  210. {
  211. "alternatives": [
  212. {
  213. "transcript": "harley how are you we have to go to "
  214. }
  215. ],
  216. "final": false
  217. }
  218. ],
  219. "result_index": 0
  220. }{
  221. "results": [
  222. {
  223. "alternatives": [
  224. {
  225. "transcript": "harley how are you we have to go down "
  226. }
  227. ],
  228. "final": false
  229. }
  230. ],
  231. "result_index": 0
  232. }{
  233. "results": [
  234. {
  235. "alternatives": [
  236. {
  237. "transcript": "harley how are you we have to go down to "
  238. }
  239. ],
  240. "final": false
  241. }
  242. ],
  243. "result_index": 0
  244. }{
  245. "results": [
  246. {
  247. "alternatives": [
  248. {
  249. "transcript": "harley how are you we have to go down to this "
  250. }
  251. ],
  252. "final": false
  253. }
  254. ],
  255. "result_index": 0
  256. }{
  257. "results": [
  258. {
  259. "alternatives": [
  260. {
  261. "transcript": "harley how are you we have to go down to the store "
  262. }
  263. ],
  264. "final": false
  265. }
  266. ],
  267. "result_index": 0
  268. }{
  269. "results": [
  270. {
  271. "alternatives": [
  272. {
  273. "transcript": "harley how are you we have to go down to the store and "
  274. }
  275. ],
  276. "final": false
  277. }
  278. ],
  279. "result_index": 0
  280. }{
  281. "results": [
  282. {
  283. "alternatives": [
  284. {
  285. "transcript": "harley how are you we have to go down to the store and see "
  286. }
  287. ],
  288. "final": false
  289. }
  290. ],
  291. "result_index": 0
  292. }{
  293. "results": [
  294. {
  295. "alternatives": [
  296. {
  297. "transcript": "harley how are you we have to go down to the store and see if "
  298. }
  299. ],
  300. "final": false
  301. }
  302. ],
  303. "result_index": 0
  304. }{
  305. "results": [
  306. {
  307. "alternatives": [
  308. {
  309. "transcript": "harley how are you we have to go down to the store and see if we can "
  310. }
  311. ],
  312. "final": false
  313. }
  314. ],
  315. "result_index": 0
  316. }{
  317. "results": [
  318. {
  319. "alternatives": [
  320. {
  321. "transcript": "harley how are you we have to go down to the store and see if we can get "
  322. }
  323. ],
  324. "final": false
  325. }
  326. ],
  327. "result_index": 0
  328. }{
  329. "results": [
  330. {
  331. "alternatives": [
  332. {
  333. "transcript": "harley how are you we have to go down to the store and see if we can get the "
  334. }
  335. ],
  336. "final": false
  337. }
  338. ],
  339. "result_index": 0
  340. }{
  341. "results": [
  342. {
  343. "alternatives": [
  344. {
  345. "transcript": "harley how are you we have to go down to the store and see if we can get the growth "
  346. }
  347. ],
  348. "final": false
  349. }
  350. ],
  351. "result_index": 0
  352. }{
  353. "results": [
  354. {
  355. "alternatives": [
  356. {
  357. "transcript": "harley how are you we have to go down to the store and see if we can get the grocery "
  358. }
  359. ],
  360. "final": false
  361. }
  362. ],
  363. "result_index": 0
  364. }{
  365. "results": [
  366. {
  367. "alternatives": [
  368. {
  369. "transcript": "harley how are you we have to go down to the store and see if we can get the groceries for "
  370. }
  371. ],
  372. "final": false
  373. }
  374. ],
  375. "result_index": 0
  376. }{
  377. "results": [
  378. {
  379. "alternatives": [
  380. {
  381. "transcript": "harley how are you we have to go down to the store and see if we can get the groceries for this "
  382. }
  383. ],
  384. "final": false
  385. }
  386. ],
  387. "result_index": 0
  388. }{
  389. "results": [
  390. {
  391. "alternatives": [
  392. {
  393. "transcript": "harley how are you we have to go down to the store and see if we can get the groceries for this we "
  394. }
  395. ],
  396. "final": false
  397. }
  398. ],
  399. "result_index": 0
  400. }{
  401. "results": [
  402. {
  403. "alternatives": [
  404. {
  405. "transcript": "harley how are you we have to go down to the store and see if we can get the groceries for this week "
  406. }
  407. ],
  408. "final": false
  409. }
  410. ],
  411. "result_index": 0
  412. }{
  413. "results": [
  414. {
  415. "alternatives": [
  416. {
  417. "transcript": "harley how are you we have to go down to the store and see if we can get the groceries for this week's "
  418. }
  419. ],
  420. "final": false
  421. }
  422. ],
  423. "result_index": 0
  424. }{
  425. "results": [
  426. {
  427. "alternatives": [
  428. {
  429. "transcript": "harley how are you we have to go down to the store and see if we can get the groceries for this week so we "
  430. }
  431. ],
  432. "final": false
  433. }
  434. ],
  435. "result_index": 0
  436. }{
  437. "results": [
  438. {
  439. "alternatives": [
  440. {
  441. "transcript": "harley how are you we have to go down to the store and see if we can get the groceries for this week so we can "
  442. }
  443. ],
  444. "final": false
  445. }
  446. ],
  447. "result_index": 0
  448. }{
  449. "results": [
  450. {
  451. "alternatives": [
  452. {
  453. "transcript": "harley how are you we have to go down to the store and see if we can get the groceries for this week so we can bring "
  454. }
  455. ],
  456. "final": false
  457. }
  458. ],
  459. "result_index": 0
  460. }{
  461. "results": [
  462. {
  463. "alternatives": [
  464. {
  465. "transcript": "harley how are you we have to go down to the store and see if we can get the groceries for this week so we can bring them "
  466. }
  467. ],
  468. "final": false
  469. }
  470. ],
  471. "result_index": 0
  472. }{
  473. "results": [
  474. {
  475. "alternatives": [
  476. {
  477. "transcript": "harley how are you we have to go down to the store and see if we can get the groceries for this week so we can bring them back "
  478. }
  479. ],
  480. "final": false
  481. }
  482. ],
  483. "result_index": 0
  484. }{
  485. "results": [
  486. {
  487. "alternatives": [
  488. {
  489. "transcript": "harley how are you we have to go down to the store and see if we can get the groceries for this week so we can bring them back in "
  490. }
  491. ],
  492. "final": false
  493. }
  494. ],
  495. "result_index": 0
  496. }{
  497. "results": [
  498. {
  499. "alternatives": [
  500. {
  501. "transcript": "harley how are you we have to go down to the store and see if we can get the groceries for this week so we can bring them back in the "
  502. }
  503. ],
  504. "final": false
  505. }
  506. ],
  507. "result_index": 0
  508. }{
  509. "results": [
  510. {
  511. "alternatives": [
  512. {
  513. "transcript": "harley how are you we have to go down to the store and see if we can get the groceries for this week so we can bring them back in the car "
  514. }
  515. ],
  516. "final": false
  517. }
  518. ],
  519. "result_index": 0
  520. }{
  521. "results": [
  522. {
  523. "alternatives": [
  524. {
  525. "transcript": "harley how are you we have to go down to the store and see if we can get the groceries for this week so we can bring them back in the car "
  526. }
  527. ],
  528. "final": true
  529. }
  530. ],
  531. "result_index": 0
  532. * Connection #0 to host gateway.watsonplatform.net left intact
  533. }
  534.  
  535. ===== CALL 4 ====
  536.  
  537. curl -v -X POST -k --header "Transfer-Encoding: chunked" --header "Content-Type: audio/x-flac; rate=22050" --header "Cookie: SESSIONID=c70affb05d39780f251f976bb1dc895c8047962" --data-binary @11.rec https://gateway.watsonplatform.net:8443/speech-to-text-beta/api/v1/models/WatsonModel/sessions/c70affb05d39780f251f976bb1dc895c/recognize -u f38e:Fl7Yo
  538.  
  539. * About to connect() to gateway.watsonplatform.net port 8443 (#0)
  540. * Trying 23.246.237.54...
  541. * connected
  542. * Connected to gateway.watsonplatform.net (23.246.237.54) port 8443 (#0)
  543. * successfully set certificate verify locations:
  544. * CAfile: /etc/ssl/certs/ca-certificates.crt
  545. CApath: none
  546. * SSL connection using AES256-SHA
  547. * Server certificate:
  548. * subject: C=US; ST=New York; L=Armonk; O=International Business Machines Corporation; CN=gateway.watsonplatform.net
  549. * start date: 2014-09
  550. * expire date: 2017-09
  551. * subjectAltName: gateway.watsonplatform.net matched
  552. * issuer: C=US; O
  553. * SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
  554. * Server auth using Basic with user 'f38e'
  555. > POST /speech-to-text-beta/api/v1/models/WatsonModel/sessions/c70affb05d39780f251f976bb1dc895c/recognize HTTP/1.1
  556. > Authorization: Basic ZTM5ZTA2ZTItZDM4Ny00MTBlLWE3MTctZDNiM2ZiM2VmMzhlOkJuam5wNGlGbDdZbw==
  557. > User-Agent: curl/7.28.1-DEV
  558. > Host: gateway.watsonplatform.net:8443
  559. > Accept: */*
  560. > Transfer-Encoding: chunked
  561. > Content-Type: audio/x-flac; rate=22050
  562. > Cookie: SESSIONID=c70affb05d39780f251f976bb1dc895c8047962
  563. > Expect: 100-continue
  564. >
  565. < HTTP/1.1 100 Continue
  566. < X-Note: Gateway Ack
  567. < HTTP/1.1 200 OK
  568. < X-Backside-Transport: OK OK
  569. < Connection: Keep-Alive
  570. < Transfer-Encoding: chunked
  571. < Server: Apache-Coyote/1.1
  572. < Date: Sun, 15 Feb 2015 00:12:17 GMT
  573. < Content-Disposition: inline; filename="result.json"
  574. < X-Zuul: zuul
  575. < X-Zuul-instance: unknown
  576. < X-Zuul-Filter-Executions: Routing[SUCCESS][0ms], ParseHostFilter[SUCCESS][0ms], PreDecoration[SUCCESS][0ms], ZuulHostRequest[SUCCESS][7962ms]
  577. < X-Originating-URL: https://gateway.watsonplatform.net:8443/speech-to-text-beta/api/v1/models/WatsonModel/sessions/c70affb05d39780f251f976bb1dc895c/recognize
  578. < Content-Type: application/json
  579. < X-Client-IP: 108.192.16.200
  580. < X-Global-Transaction-ID: 173706517
  581. <
  582. {
  583. "results": [
  584. {
  585. "alternatives": [
  586. {
  587. "transcript": "harley how are you we have to go down to the store and see if we can get the groceries for this week so we can bring them back in the car "
  588. }
  589. ],
  590. "final": true
  591. }
  592. ],
  593. "result_index": 0
  594. * Connection #0 to host gateway.watsonplatform.net left intact
  595. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement