I'm trying to get data out of this one [https://developer.mapquest.com/documentation/geocoding-api/reverse/get](MapQuest Reverse Geocode)
$ApiKey = "xxxxx" #Add your key here
$Url = "http://www.mapquestapi.com/geocoding/v1/reverse?key=$ApiKey"
$ApiBody = @{
location = @{
latLng = @{
'lat' = 55.40988888
'lng' = 11.39666277
}
}
options = @{
'thumbMaps' = 'false'
}
includeNearestIntersection = 'false'
includeRoadMetadata = 'true'
}
write-host ( $ApiBody | ConvertTo-Json)
$response = Invoke-RestMethod $Url -Method get -Headers @{ 'Content-Type' = 'application/json' } -Body $ApiBody
#TEST 2
$Url = "http://www.mapquestapi.com/geocoding/v1/reverse?key=$ApiKey"
$ApiBody = @{
'location' = @{
'latLng' = @{
'lat'= 55.40988888
'lng'= 11.39666277
}
}
}
#$ApiBody = $ApiBody | ConvertTo-Json
$response = Invoke-RestMethod $Url -Method Post -Body $ApiBody
$response
I keep getting a 400 response :/
When I do it in PostMan it works:
It seems that I don't format the body form correctly !?
Still it wont work