Searching Tweets Always Returns 400 Error


#1

I’ve had an app that was using the 1.0 Search API and now obviously needs to move to 1.1. Every search I try using the new API Url fails though with a 400 Bad Request error. That includes the samples from Twitter’s own developer documentation (I just copied and pasted in the browser). For example, here’s a query I was using:
http://search.twitter.com/search.json?q=from%3A%40pdxtrailblazers

So based on the documentation I changed it to this:
https://api.twitter.com/1.1/search/tweets.json?q=from:@pdxtrailblazers

And that returns a 400 Bad Request error. I also tried the suggestion in the documentation to try a search from the twitter site (which worked), and then just replace the host name with the API Url, but it also fails with the 400 Bad Request error. So to be clear, that includes these same examples from the Search documentation (i.e. these are all returning 400 Bad Request for me):

  1. https://api.twitter.com/1.1/search/tweets.json?q=%23freebandnames&since_id=24012619984051000&max_id=250126199840518145&result_type=mixed&count=4
  2. https://api.twitter.com/1.1/search/tweets.json?q=%40twitterapi
  3. https://api.twitter.com/1.1/search/tweets.json?q=%40twitterapi%20%40anywhere
  4. https://api.twitter.com/1.1/search/tweets.json?q=%40twitterapi%20-via

?? What could I be doing wrong??


#2

API v1.1 requires authentication for all requests, including Search API requests. You either need to leverage OAuth 1.0A and a user-context to perform these searches, or use are app-only auth form of search.