0

I am new to use Google api nearest roads to snap the roads.

I was trying as in the below link:

Google api for nearest road

If I have to try the

https://roads.googleapis.com/v1/nearestRoads?parameters&key=YOUR_API_KEY

with the api key provided in my Project, I get

{
"error": {
    "code": 403,
    "message": "Roads API has not been used in project **** before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/roads/overview?project=*** then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
    "status": "PERMISSION_DENIED",
    "details": [
        {
            "@type": "type.googleapis.com/google.rpc.Help",
            "links": [
                {
                    "description": "Google developer console API activation",
                    "url": "https://console.developers.google.com/apis/api/roads/overview?project=****"
                }
            ]
        }
    ]
}

replaces the key used.

What am I missing here? Should I verify the key somewhere before using? Or if I want to just try out the samples how do I get the key?

Hash
  • 4,647
  • 5
  • 21
  • 39
pgman
  • 493
  • 3
  • 12
  • 21

1 Answers1

1

"Roads API has not been used in project **** before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/roads/overview?project=*** then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",

This error message is a little confusing. Before you can access an API you need to enable it in your project on Google developer console. To do that

  1. Go to https://console.developers.google.com/apis/dashboard
  2. make sure your project is selected at the top.
  3. Go to library
  4. search for roads api
  5. Enable it.

Wait a few minutes and your code should then work

Detailed info:

When you want to access Google data google needs to know who you are. And what your project will be doing. They do that by asking you to create a project on google developer console. In that project you can define the apis you will be using and you can also request api keys and client ids which will allow you to access data. In this instance you are having an issue with the set up of your project on google developer console it has nothing to do with your code.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
  • selecting my project in the sense should i select the actual project that i code in? Also when i try to go to dashboard, it asks me to sign in... so should i use my gmail account? since am using my work related project am bit confused here – pgman May 29 '18 at 09:24
  • 1
    Your project is already slected in your code google knows what project the key is linked to. This is an issue in the setup of your project on Google developer console. You should sign in with what ever account you used to create the project that the API key you are currently using linked to. – Linda Lawton - DaImTo May 29 '18 at 09:28