jump to navigation

Display Your Latest Tweets with Twitter’s API December 28, 2011

Posted by Tournas Dimitrios in JQuery.

This  short article will demonstrate how to  display your latest tweets into a webpage by querying Twitter’s API  . You don’t have to know any coding experience , though a little bit of CSS will help you to style the result to your preferred “taste” . For a live demonstration look at the side-bar of my blog .

body {
background-color: #555;
#twitter_update_list {
max-height: 300px;
font-size: 14px;
padding: 12px;	
<div id="twitter_update_list"></div>
<script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/TDimitrios.json?callback=twitterCallback2&count=100"></script>

The query-string must contain the name of your Twitter-account and  number of expected last- published  tweets . My example made a request for the last 100 tweets from TDimitrio’s  Twitter’s account . The returned result is in Json format and should be parsed automatically for you , though , a div tag with the name of ” id=”twitter_update_list” must be present somewhere in the your website’s layout (for example in your sidebar )  .  A good practice is to store API responses in your application or on your site if you expect a lot of use . For example , don’t try to call the Twitter API on every page load of your website landing page . Instead , call the API infrequently and load the response into a local cache . When users hit your website load the cached version of the results .  If you or your application abuses the rate limits , Twitter will blacklist your IP ( Read more  ) .



No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s