Geocoding service error when calling Directions service

3 posts / 0 new
Last post
lhidev
Geocoding service error when calling Directions service

Hello,

 

I am using my free key to call the directions api as shown in the request below and getting an error that the key is not valid for geocoding service. I was able to call the GeoCoding service outside of this call to directions service. (NOTE: I have expanded the request for easy readability below)

Do I need a separate key for geocodeing and directions api? Is there any special activation needed to call directions api.

I would really appreciate any help in resolving this.

 

Thank You! 

 

REQUEST:

http://www.mapquestapi.com/directions/v2/route?key=MY_FREE_KEY&inFormat=json&outFormat=json&doReverseGeocode=false&routeType=fastest&timeType=1&enhancedNarrative=false&shapeFormat=raw&generalize=0&locale=en_US&unit=m&json={"locations":[{"location":{"type":"s","city":"CityA","country":"US","street":"StreetA","postalCode":"ZipCodeA"}},{"location":{"type":"s","city":"CityB","country":"US","street":"StreetB","postalCode":"ZipCodeB"}}]}

RESPONSE:

{"collections":[],"info":{"copyright":{"text":"© 2015 MapQuest, Inc.","imageUrl":"http://api.mqcdn.com/res/mqlogo.gif","imageAltText":"© 2015 MapQuest, Inc."},"statuscode":500,"messages":["This key is not authorized for the Geocoding service."]}}

 

EXPANDED REQUEST:

http://www.mapquestapi.com/directions/v2/route?key=MY_FREE_KEY
&inFormat=json
&outFormat=json
&doReverseGeocode=false
&routeType=fastest
&timeType=1
&enhancedNarrative=false&shapeFormat=raw&generalize=0&locale=en_US&unit=m&
json={
        "locations":
            [
                {
                    "location":
                        {
                            "type":"s",
                            "city":"CityA",
                            "country":"US",
                            "street":"StreetA",
                            "postalCode":"ZipCodeA"
                        }
                },
                {
                    "location":
                        {
                            "type":"s",
                            "city":"CityB",
                            "country":"US",
                            "street":"StreetB",
                            "postalCode":"ZipCodeB"
                        }
                }
            ]
    }


MQBrianCoakley
That's a bad error message,
That's a bad error message, but remove the "location" identifier within locations (just the {address} is fine) and you should be good to go.

lhidev
Thank you for the quick

Thank you for the quick response!!. That resolved it.