问题
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