Twitter has several different APIs but the Streaming and Search APIs are the ones to take note of.

Twitter Developer - Learn About APIs

Search API

The Search API lets developers write code to automate searches for tweets by keyword, topic, author, language, location. According to Twitter, their Search API only returns a sample of Tweets from the past 7 days.  The Search API is rate limited – meaning you can only perform 180 searches every 15 minutes.  For humans that might seem like a lot but this is a constraint to developers.

“The sampling  is focused on relevance and not completeness. This means that some Tweets and users may be missing from search results. If you want to match for completeness you should consider using a Streaming API instead.”

Streaming API

The Streaming API is used when developers want to access current tweet data.  The public sample contains about 1% of tweets. In GNIP, the enterprise version, there is a streaming API which will give you 10% of all public tweets (also called the Decahose – enough to be statistically significant).  Then there is the paid access to every tweet sent ever by anyone in the entire history of time (also known as Twitter’s Firehose).  Very few projects need or get access to this.

JSON data format

The APIs use the JSON data format which is very similar to structured data found in a CSV file.   This means that with a bit of code and some data manipulation, JSON data can be exported to Excel or Google Sheets. Google Sheets in particular can be powered with Google Scripts (that’s equivalent to using Javascript to automate actions on your spreadsheet, similar to macros but way more powerful ) and apps like Blockspring or TAGS enables those with spreadsheet skills to have Twitter Developer superpowers without knowing any code!

Accessing Twitter’s API

In order to access Twitter’s API, you need to register as a developer and obtain API keys.  Go to Twitter Application Management (note: all you need is a mobile number, you don’t really have to be a developer or register a real app) and get a set of Consumer Keys.

This will allow you to access Twitter’s Search and Streaming APIs, as well as post tweets.  If you wish to send direct messages or add to Twitter lists, you’ll need to get Access Tokens as well.

Twitter API keys

1. Using Blockspring

If you’re not a developer, you can use Blockspring to query and extract data from the API. With your API keys, go to Blockspring (PAID, with 14 days free trial).

After obtaining your API keys, you will need to get the Tweet ID for whichever tweet you wish to look up.  The Tweet ID refers to the string of 18 numbers behind the URL of any the tweet which you can find by right clicking on the three dots and select Copy Link to Tweet.

If it’s just one tweet that you want to check, you can use the open console on Blockspring’s website which will return the full results from Twitter’s API. Say I want to look up the number of faves and retweets. Look for this block -> “Get Info About a Tweet“.

Type in the Tweet ID, hit run and look for Favourite_Count and Retweet_Count.  You can see that both numbers tie exactly with the figures on my tweet.

Using Blockspring in a Spreadsheet

You can perform more powerful Blockspring functions such as “Get info about a user”, “Get users’ last 200 tweets”, “Add to list”, “Fave”, “Retweet”, “Follow”, “Unfollow” in bulk using Google Sheets – go to Google Sheets, install the add-on and run the block there. If you’re more comfortable with spreadsheets than with code, you will fall in love with Blockspring. Be warned, it’s seriously addictive!

To see how I use Blockspring with Google Sheets, read Hacking Premium Twitter Tools and How to Stalk a Venture Capitalist.

Here are some screenshots:

Get a User’s Info on Twitter

Blockspring Twitter

Get a User’s Followers – and follow them in bulk by copying and pasting a formula!

Blockspring Twitter 2

Get a User’s Latest Tweets – and like and retweet in bulk!

Blockspring Twitter 3


2. Using Twitter’s API Console

The Twitter website also has an API console where you can make pretend like you’re a real developer and make an API call (how cool does that sound!)

Go to the API Console Tool.  Don’t let the GET/ POST jargon or the user unfriendly output format put you off. It’s pretty intuitive.  Look for Get/statuses/show(id)json, enter the tweet ID and you will get the same results that I showed you via Blockspring.

3. Twitter client for MAC

A third way is if you have the new Twitter client for MAC, where the developer console allows you to view Tweet JSON, right from your computer.

Open up the developer console or click on View Tweet JSON and you’ll get exactly what the API console shows.

Twitter for MAC Developer Console

There you go! Three ways in which you can access Twitter’s API without being a developer or knowing any code!

If you haven’t, do read my previous post on What Analytics do you get from Twitter’s API!

Tagged with: ,