Need simple Twitter API v1.1 example to show timeline using jQuery or C# ASP.NET

Posted by Ken Palmer on Stack Overflow See other posts from Stack Overflow or by Ken Palmer
Published on 2013-06-13T21:10:14Z Indexed on 2014/05/28 9:27 UTC
Read the original article Hit count: 196

Filed under:
|
|
|

With Twitter turning off the API 1.0 faucet on 6/11/2013, we have several sites that now fail to display timelines. I've been looking for an "If you did that, now do this" example. Here was Twitter's announcement. https://dev.twitter.com/blog/api-v1-is-retired

Here is what we were originally doing to show the Twitter timeline via API 1.0.

<div id="twitter">
    <ul id="twitter_update_list"></ul>
    <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
    <script type="text/javascript" src="http://api.twitter.com/1/statuses/user_timeline/companytwitterhandle.json?callback=twitterCallback2&amp;count=1"></script>
    <div style="float:left;"><a href="https://twitter.com/companytwitterhandle" target="_blank">@companytwitterhandle</a> | </div>
    <div class="twitterimg">&nbsp;</div>
</div>

Initially I tried changing the version in the JavaScript reference URL like so, which did not work.

<script type="text/javascript" src="http://api.twitter.com/1.1/statuses/user_timeline/companytwitterhandle.json?callback=twitterCallback2&amp;count=1"></script>

Then I looked at the Twitter API documentation (https://dev.twitter.com/docs/api/1.1/overview) which lacks a clear transition example. I don't have 4 or 5 hours to delve into that, or into this disheveled FAQ (https://dev.twitter.com/docs/faq#17750).

Then I found this API documentation regarding the user timeline. So I changed the URL again as shown below. https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline

<script type="text/javascript" src="https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=companytwitterhandle&amp;count=1"></script>

That did not work.

Using jQuery or C# ASP.NET MVC, how can I transition that interface from Twitter API 1.0 to Twitter API 1.1? My first preference would be for a browser client side implementation if that is possible. Please include a code example. Thanks.

© Stack Overflow or respective owner

Related posts about c#

Related posts about jQuery