10

is it possible to search with the new Twitter Rest API without OAuth.

I simply want to search for tweets with a given hashtag.

For example I call: https://api.twitter.com/1.1/search/tweets.json?%23MyTag

where %23 is the encoded "#"

However I allways get

{"errors":[{"message":"Bad Authentication data","code":215}]}

I guess its because im not authenticated...

Is it possible to run a search without OAuth?

Jimbo
  • 25,790
  • 15
  • 86
  • 131
sockeqwe
  • 15,574
  • 24
  • 88
  • 144

2 Answers2

16

The Twitter API docs specify that user-context authentication is required when making a call to search Tweets (see https://dev.twitter.com/docs/api/1.1/get/search/tweets) so it looks like you will need to get your hands on Twitter OAuth tokens and sign your request.

If you log in to Twitter and go to the developer dashboard at https://dev.twitter.com/apps, you can register a new application: after registering, viewing the application details will give you an "oAuth Tool" tab, where you'll find all the relevant oAuth values for that app: Consumer Key, Consumer Secret, Access Token, and Access Token Secret.

You can then use these credentials, in conjunction with a Twitter wrapper library, to do a Twitter search. There's no need to do the OAuth approval dance on a per-user basis: you should be able to hard-code the values from the Twitter dashboard.

mflaming
  • 1,167
  • 7
  • 8
  • I need your guide regarding fetch timeline of authenticated user, which being authenticated using twitter4j lib in Android app, I am having bad authentication data error in response – Abdul Wahab May 13 '13 at 12:29
0

Initially one can test the Twitter Search API by using this, this is basically the console for the Twitter Search API.

Here you can also get the error of "Bad Authentication," but that could be solved using the OAuth authentication which links you to your twitter account.

The option for OAuth is on the top of the console.

Aadil
  • 189
  • 4