Google Speech API how to pickup results of my asyncrecognize request

三世轮回 提交于 2019-12-11 05:32:21

问题


I executed the following

curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer ${MY_ACCESS_TOKEN} " https://speech.googleapis.com/v1beta1/speech:asyncrecognize -d @json/automator.json

which returned

{
  "name": "376034185739864225"
}

I tried using the interactive GET available here` passing in that name value above, (about 12 hours later),

but got back

{
 "error": {
  "code": 404,
  "message": "Requested entity was not found.",
  "status": "NOT_FOUND"
 }
}

Am I missing something? Like, how to perform this properly, or my speech recognition response? Is it out there in the cloud somewhere?


回答1:


I just had the same problem. Long story short, you have to use the same API key you POST with.

If you POST with

https://speech.googleapis.com/v1beta1/speech:asyncrecognize?key=AWESOMEKEY123

You have to retrieve results with

https://speech.googleapis.com/v1beta1/operations/NAME?key=AWESOMEKEY123

Your specified page uses a different API key.




回答2:


In my case, I followed the tutorial and created a Service Account with its corresponding credentials, but it seems that to retrieve results from the web you need to create an API key even though Service Account is the preferred method for authentication.

I think this is because to retrieve the results from the web you explicitly need an API Key for the project (tried all other keys I could get from the service account but none worked, but that's probably because I'm still new to this authentication mumbo jumbo).

After creating an API key in the credentials, you can pretty much use it without problem for viewing the recognition results. I'm new to this too but so far is the only method that has worked consistently for me.



来源:https://stackoverflow.com/questions/39959479/google-speech-api-how-to-pickup-results-of-my-asyncrecognize-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!