Search code examples
google-apigoogle-cloud-platformgoogle-authenticationgoogle-cloud-speech

Google Speech API: the requested URL was not found on this server


I am attempting some simple tests on the Google Speech API, and when my server makes a request to this url (below), I get the 404. that's an error response. Not sure why.

https://speech.googleapis.com/v1/speech:recognize?key=[MY_API_KEY]

The body of my request looks like this:

{
    "config": {
        "languageCode": "en-US",
        "encoding": "LINEAR16",
        "sampleRateHertz": 16000,
        "enableWordTimeOffsets": true,
        "speechContexts": [{
            "phrases": ["Some", "Helpful", "Phrases"]
        }]
    },
    "audio":{
        "uri":"gs://mydomain.com/my_file.mp3"
    }
}

And here is the response:

enter image description here

As you can see, that is a valid resource path, unless I'm totally mistaken about something (I'm sure I am): https://cloud.google.com/speech-to-text/docs/reference/rest/v1/speech/recognize

Update 1:, Whenever I try this with the Google API explorer tool, I get this quota exceeded message (even though I have not yet issued a successful request to the API).

{
  "error": {
    "code": 429,
    "message": "Quota exceeded for quota metric 'speech.googleapis.com/default_requests' and limit 'DefaultRequestsPerMinutePerProject' of service 'speech.googleapis.com' for consumer '[MY_API_KEY]'.",
    "status": "RESOURCE_EXHAUSTED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.Help",
        "links": [
          {
            "description": "Google developer console API key",
            "url": "https://console.developers.google.com/project/[my_project_id]/apiui/credential"
          }
        ]
      }
    ]
  }
}

Update 2: Interestingly, I was able to get some 200 ok's using the Restlet client, but even in those cases, the response body is empty (see screenshot below)

enter image description here


Solution

  • I have made a test by using the exact URL and Body content you added to the post, however, I was able to execute the API call correctly.

    I noticed that if I add some extra character to the URL, it fails with the same 400 error since it doesn't exist. I would suggest you to verify that the URL of your request doesn't contain a typo and that the client you use is executing the API call correctly. Also, ensure that your calling code is not encoding the url, which could cause issues given the colon : that appears in the url.

    I recommend you to perform this test by using the Try this API tool directly or Restlet client which are the ones that I used to replicate this scenario.