Parsing error in Google GeoLocate JSON API example
Google changed its GeoLocation api and didn't update the documentation?
I followed their example code verbatim on the next page
https://developers.google.com/maps/documentation/geolocation/intro
I have pasted the sample request into a file on my system called ex.json. I double checked that my Google Geolocation API is enabled and ran the following curl command
curl -d ex.json -H "Content-Type: application/json" -i "https://www.googleapis.com/geolocation/v1/geolocate?key=[My key, yes I pasted my actual key in]"
I got the following answer
{
"error": {
"errors": [
{
"domain": "global",
"reason": "parseError",
"message": "Parse Error"
}
],
"code": 400,
"message": "Parse Error"
}
}
Which according to the documentation means there is something wrong with the json example they provided. Just for completeness, the json sample looks like
{
"homeMobileCountryCode": 310,
"homeMobileNetworkCode": 260,
"radioType": "gsm",
"carrier": "T-Mobile",
"cellTowers": [
{
"cellId": 39627456,
"locationAreaCode": 40495,
"mobileCountryCode": 310,
"mobileNetworkCode": 260,
"age": 0,
"signalStrength": -95
}
],
"wifiAccessPoints": [
{
"macAddress": "01:23:45:67:89:AB",
"signalStrength": 8,
"age": 0,
"signalToNoiseRatio": -65,
"channel": 8
},
{
"macAddress": "01:23:45:67:89:AC",
"signalStrength": 4,
"age": 0
}
]
}
JsonLint has verified that it is valid Json and the documentation says that all fields are optional. What am I missing, was some required field added after writing the documentation?
+3
source to share