Bobby S
Bobby S

Reputation: 4116

Twitter API 1.1: Return all tweets that contain a certain hashtag OR are by a specific user

Is there an API call which will return all the tweets which contain an specific hashtag (#example) and also all the tweets from a certain user (@example)?

Looking for a single API call, that returns a JSON object with both those criteria. I know I can do with two separate API calls, but I an trying to do this with one. Possibly https://dev.twitter.com/docs/api/1.1/get/search/tweets is the best bet.

Upvotes: 2

Views: 4833

Answers (2)

Shashank Saxena
Shashank Saxena

Reputation: 2028

https://api.twitter.com/1.1/search/tweets.json?q=shrmi14

is the one that i used.

Incase you feel issues. refer https://dev.twitter.com/console for generating your own queries..

Upvotes: 0

Joe Mayo
Joe Mayo

Reputation: 7513

When you use multiple terms together, Twitter search performs an AND operation by default. i.e.

https://dev.twitter.com/docs/api/1.1/get/search/tweets.json?q=from%3AJoeMayo%20%23twitterapi

Returns only tweets that are from JoeMayo and contain #twitterapi.

You can experiment with it on Twitter's Search page.

Upvotes: 5

Related Questions