John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

Issue with Mapquest API service response...

Hi, I am using mapquest api to get location information with the longitude and latitude Im sending them. I got my developer key and everything, Im getting a bad (but successful test) response from them:

renderReverse({
"results":[
{
"locations":[

Code: Select all

         ], 
         "providedLocation":{ 

         } 
     } 
 ], 
 "options":{ 
     "ignoreLatLngInput":false, 
     "maxResults":-1, 
     "thumbMaps":true 
 }, 
 "info":{ 
     "copyright":{ 
         "text":"© 2013 MapQuest, Inc.", 
         "imageUrl":"[url=http://api.mqcdn.com/res/mqlogo.gif]http://api.mqcdn.com/res/mqlogo.gif[/url]", 
         "imageAltText":"© 2013 MapQuest, Inc." 
     }, 
     "statuscode":400, 
     "messages":[ 
         "Illegal argument from request: Insufficient info for location." 
     ] 
 } 

});

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

Issue with Mapquest API service response...

they say in their instructions here:

http://www.mapquestapi.com/geocoding/...

that my request url must be in this format:

http://www.mapquestapi.com/geocoding/...

and my request parameters must be: 'lat' and 'lng'

But, they keep saying in their response: "Illegal argument from request: Insufficient info for location."

Is there anything you guys see I did wrong setting up this service?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Issue with Mapquest API service response...

Hi John,

I'll take a look.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Issue with Mapquest API service response...

You should contact Mapquest support.. that's what the service returns, nothing to do with Appery.io.

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

Issue with Mapquest API service response...

ok I do understand that, but do you see if somehow i set it up wrong? Im just guessing that maybe my url structure is wrong...

well, let me ask you this then... when Im posting a json structure with one or more request parameters, how does Appery send the full complete url?

-------------------------------------------------------

Because in my settings (this example is for inFormat = Key/Value pairs), I put this url:

http://www.mapquestapi.com/geocoding/...

where 'Fmjtd%7Cluub2gutn0%2Cag%3Do5-9uaw14' = YOUR_KEY_HERE

according, to their site, my url structure should look like this in my request:

http://www.mapquestapi.com/geocoding/...

where '42.5174672,-83.10717450000001' = lat,lng

I get this error message:

... },
"statuscode":400,
"messages":[
"Illegal argument from request: Insufficient info for location."
]
}...

----------------------------------------------------------

If I'm using: inFormat = JSON, I put this url:

http://www.mapquestapi.com/geocoding/...

according, to their site, my url structure should look like this in my request:

http://www.mapquestapi.com/geocoding/...

I get this error message:

},
"statuscode":400,
"messages":[
"Illegal argument from request: Error parsing JSON from Request: A JSONObject text must begin with '{' at character 0 of , Please see the documentation for the Geocoding Service at http://www.mapquestapi.com/geocoding/ for details on correctly formatting requests."
]
}

----------------------------------------------------------------

It looks to me that the my url structure might be off. I even had my back-end guy look at this and he said they look right, then he told me to ask you guys to see how else its manipulated??

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Issue with Mapquest API service response...

Please try invoking the service directly from the browser address bar or as a curl command. If that works for you but doesn't work when defining a service in Appery.io -- we will help you.

Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

Issue with Mapquest API service response...

If your using chrome..
What I like to do is test run the app in the browser and open the Developer tools . Click on the Network tab up top. Now click the script name that called mapquest. Now you can see plain text version of POST or GET and what was sent. Then click the Response tab and see the result.

Also. If working with JSON. Install Json View pluging.
https://chrome.google.com/webstore/de...

Its great for viewing json data.

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

Issue with Mapquest API service response...

ok, i figured the problem on mapquests site they say its a post request when its a get request. Now, the problem is that Appery wont allow me to automatically create a response, this is an example what mapquest returns:

renderReverse({
"results":[
{
"locations":[
{
"latLng":{
"lng":-83.107174,
"lat":42.517467
},
"adminArea4":"Oakland",
"adminArea5Type":"City",
"adminArea4Type":"County",
"adminArea5":"Madison Heights",
"street":"141 W La Salle Ave",
"adminArea1":"US",
"adminArea3":"MI",
"type":"s",
"displayLatLng":{
"lng":-83.107174,
"lat":42.517467
},
"linkId":19527449,
"postalCode":"48071",
"sideOfStreet":"R",
"dragPoint":false,
"adminArea1Type":"Country",
"geocodeQuality":"ADDRESS",
"geocodeQualityCode":"L1AAA",
"mapUrl":"http://www.mapquestapi.com/staticmap/...",
"adminArea3Type":"State"
}
],
"providedLocation":{
"latLng":{
"lng":-83.107175,
"lat":42.517467
}
}
}
],
"options":{
"ignoreLatLngInput":false,
"maxResults":-1,
"thumbMaps":true
},
"info":{
"copyright":{
"text":"© 2013 MapQuest, Inc.",
"imageUrl":"http://api.mqcdn.com/res/mqlogo.gif",
"imageAltText":"© 2013 MapQuest, Inc."
},
"statuscode":0,
"messages":[

Code: Select all

     ] 
 } 

});

------------------------------------------------------------------

my question is how can I map these responses?

"adminArea4":"Oakland",
"adminArea5Type":"City",
"adminArea4Type":"County",
"adminArea5":"Madison Heights",
"street":"141 W La Salle Ave",
"adminArea1":"US",
"adminArea3":"MI",

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Issue with Mapquest API service response...

Run the returned JSON here: http://jsonlint.com. It's not a valid JSON.

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

Issue with Mapquest API service response...

well, this is my full url when i tested there:

http://www.mapquestapi.com/geocoding/...

and i get the same results in the same format. In the 'Results' body i get this back:

Parse error on line 1:
renderReverse({
^
Expecting '{', '['

Return to “Issues”