2

So Im trying to use the Google GeolocationAPI. It sends the quest successfully and also authenticates successfully with my api key but it returns me this

    {
        "error": {
            "code": 404,
            "message": "Requested entity was not found.",
            "errors": [
                {
                    "message": "Requested entity was not found.",
                    "domain": "global",
                    "reason": "notFound"
                }
            ],
            "status": "NOT_FOUND"
        }
    }

The url Im requesting to is https://www.googleapis.com/geolocation/v1/geolocate?key=MY_KEY with post as described in the documentation.

Thanks in advance

F4LS3
  • 151
  • 2
  • 11

4 Answers4

4

I recommend you to check out the documentation:

As you can read:

Before you start developing with the Geolocation API, review the authentication requirements (you need an API key) and the API usage and billing information (you need to enable billing on your project).

I was getting the exact same error until my billing information was validated. How I realized it, was using the geocoding API, which does return a better error.

sebacruzd
  • 76
  • 5
  • 1
    In the documentation its says: "The request body must be formatted as JSON. The following fields are supported, and all fields are optional" – F4LS3 Sep 06 '20 at 10:26
  • You are right @F4LS3 I updated the answer. I was having the exact same error and that did fix it. – sebacruzd Sep 09 '20 at 13:44
  • My account is a verified billing account.But still I am facing the same issue. Can you please check my [question](https://stackoverflow.com/questions/66167163/unable-to-execute-rest-api-via-curl)? – Moeez Feb 12 '21 at 06:56
  • @Moeez I answered your question but it was removed soon after that. I recommend you try making a request to Geocoding, because the errors in that API are more helpful than in Geolocation. I hope you can fix your problem. – sebacruzd Feb 26 '21 at 14:22
0

You need to create and associate a billing account to your project. It will work immediately.

mth
  • 1
0

We started getting a 404 error just because our credit card expired and Google could not bill us. When we updated the billing information the API came to life again.

Au Ris
  • 4,541
  • 2
  • 26
  • 53
0

usually, this error occurs when user access is revoked.

Bilal Tariq
  • 639
  • 4
  • 7