How do I get tweets based on location only?


#1

Hi,

I am using the following: https://api.twitter.com/1.1/search/tweets.json?q=SomeSearchTerm&geocode=37.781157,-122.398720,1mi to get tweets from a certain location. I have noticed that the q parameter needs to have a value or else I get “The remote server returned an error: (401) Unauthorized”.

When using the now deprecated Search API : http://search.twitter.com/search.json?q=&geocode=37.781157,-122.398720,1mi one could omit a value for the q parameter.

Is there a wildcard character or any other way to omit a specific value for q in https://api.twitter.com/1.1/search/tweets.json?q=…?

Thanks Ewald


#2

I think you may be encoding your oauth request incorrectly. I was able to send a successful search query to 1.1 with a blank ‘q’ parameter.

Here’s what my signature base string looked like:

GET&https%3A%2F%2Fapi.twitter.com%2F1.1%2Fsearch%2Ftweets.json&geocode%3D37.781157%252C-122.398720%252C1mi%26oauth_consumer_key%3D...%26oauth_nonce%3DToul8%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1364420628%26oauth_token%3D...%26oauth_version%3D1.0%26q%3D

In the v1 world an invalid signature would have fallen back onto anonymous quota, which may be why you didn’t notice this earlier.


#3

Thanks! That was the problem.