Example GET with lat/long queries Invalid Coordinates


#1

The documented example GET requests using lat and long query keep giving me Invalid Coordinates.

/1.1/trends/closest.json?lat=37.781157&long=-122.400612831116
or
/1.1/geo/reverse_geocode.json?lat=37.76893497&long=-122.42284884

{“errors”:[{“code”:3,“message”:“Invalid coordinates.”}]}


#2

Hey, please verify that you are encoding these values right. You need to use URL encoding. I just tried it and it works fine here:

{ 
    "result": { 
        "places": [ 
            { 
                "id": "5a110d312052166f", 
                "url": "https://api.twitter.com/1.1/geo/id/5a110d312052166f.json", 
                "place_type": "city", 
                "name": "San Francisco", 
                "full_name": "San Francisco, CA", 
               /* Truncated */

If the url encoding is not the issue, please let us know, as it might be an issue with the API then.


#3

Thanks ePirat. Could you show the command? I am a little of a noob with GET commands.

I am using twurl (oauth authenticated) which works for most of the other GETs (I haven’t tried all of them), including trends/places.json?id=

This works:
twurl /1.1/search/tweets.json?q=%23freebandnames&since_id=…

This doesn’t
twurl /1.1/trends/closest.json?lat=37.781157&long=-122.400612831116

Thanks again!


#4

Maybe you forgot quoting the string?

twurl "/1.1/trends/closest.json?lat=37.781157&long=-122.400612831116"
[{"name":"San Francisco","placeType":{"code":7,"name":"Town"},"url":"http:\/\/where.yahooapis.com\/v1\/place\/2487956","parentid":23424977,"country":"United States","woeid":2487956,"countryCode":"US"}]

works fine for me.


#5

Hmmm, I thought I had before. All that because of quotes, doh! Thanks ePirat!!!