Sending api key with POST data

2 posts / 0 new
Last post
marci
Sending api key with POST data

I'm trying to get the elevation service working with json post data. When I'm useing just the URL based solution, it works fine, but if I try to send my request in post data, i keep getting "The AppKey submitted with this request is invalid." error.

Here is what i'm trying:

url: 

"http://open.mapquestapi.com/elevation/v1/pofile?key=MY_APP_KEY?inFormat=json"

postdata:

{"locations":[{"latLng":{"lat":"47.50489121329296"}},{"latLng":{"lng":"19.02025040032767"}},{"latLng":{"lat":"47.50393451856566"}},{"latLng":{"lng":"19.018726905607064"}},{"latLng":{"lat":"47.5035721296458"}},{"latLng":{"lng":"19.017825683378156"}},{"latLng":{"lat":"47.50393451856566"}},{"latLng":{"lng":"19.017203410886466"}},{"latLng":{"lat":"47.50434039118526"}},{"latLng":{"lng":"19.016645511411127"}}],"key":"MY_APP_KEY"}

headers:

'Content-Type: application/json',
'Content-Length: <whatever the length is>'

As you cen see I tried submitting my key both in the url and the json, also tried only one or the other.
I'm certain my key is valid, i can use the 
http://open.mapquestapi.com/elevation/v1/profile?key=YOUR_KEY_HERE&callb... format just fine.

Any suggestion?

 


MQBrianCoakley
The key must be in the url
The key must be in the url rather than the post data. Make sure there is a & between the key value and the inFormat parameter name. Currently there are too many ?s.   "http://open.mapquestapi.com/elevation/v1/pofile?key=MY_APP_KEY&inFormat=..."