Building Search Queries for Twitter’s REST API 1.1

22 Kudos

I recently need to get a JSON object from Twitter’s API that had a couple of requirements. I needed the most recent tweets that contained a specific hashtag OR were from a specific user AND didn’t contain any retweets.

Starting with the base API URL for search

Then appending each piece of the search as required OR #example OR #example + exclude:retweets

Then a proper URL encode results in

TIP: To find out what the URL should be after the ?q= do a search how you would like on or and copy of the tail end of the URL and stick it onto yours.

Also read...