A .net 3.5 wrapper for the Twitter API
Author: Deepak Prasad (dee@newbtech.com)
Version: 1.0.0.4 (Alpha) – PREVIEW RELEASE
Ability to retrieve a specified user’s followers (just their Id’s) in version 1.0.0.4
Ability to retrieve a specified user’s details (given their screen id) in version 1.0.0.4
This library provides a simple .net interface for the Twitter API. The main Twitter API documentation is here: (http://apiwiki.twitter.com/Twitter-API-Documentation). What the NewbtechTwitter library tries to do is wrap as many of these calls as possible and returns back friendly objects that you can access to get the most out of the Twitter API’s.
Note: It makes use of the XML Web Services of the Twitter API.
As development is continuing, the latest release notes can always be found here: http://www.newbtech.com/twitterapiwrapper/release-notes
You can review the complete list of methods here:
http://www.newbtech.com/twitterapiwrapper/methods-available (updated 1.0.0.4 – 19 October 2009).
More methods will be made available in subsequent releases. If there is any one in particular that you are looking for, please let me know.
Visual Studio 2008 with .Net 3.5 SP1
To download, use the following link :
Latest build: Version 1004 (October 19, 2009)
- http://www.newbtech.com/TwitterAPI/Newbtech.TwitterAPI.1004.zip (release notes)
Older builds:
This assumes that you have referenced the three DLL’s in the archive above within your project and have put the following using statements in your class:
using Newbtech.TwitterAPI; using Newbtech.TwitterAPI.Objects;
Most of the methods returns back generic lists of objects that you can easily reference. As an example, if you wish to get a list of your friends (people you follow):
TwitterAPI.Interface api = new Interface(USERNAME, PASSWORD);
Friends friends = api.GetFriends();
Then to list out all your friends, you would simply go through the friends list and access each user:
foreach (UserDetails user in friends.FriendsList) { Console.WriteLine(user.ScreenName); }
I will be adding more detailed documentation later. Most of the functionality should be pretty much self-explanatory. I also include the source XML for each object as a public property just in case you wish to traverse through them to get any additional information.
As an example, the UserDetails class (which stores the information about a user) contains the following:
public XmlElement SourceXml { get; set; } public string Id { get; set; } public string Name { get; set; } public string ScreenName { get; set; } public string Location { get; set; } public string Description { get; set; } public string ProfileImageUrl { get; set; } public string Url { get; set; } public TriState Protected { get; set; } public long FollowerCount { get; set; } public long FriendsCount { get; set; } public long FavoritesCount { get; set; } public long StatusCount { get; set; } public TriState IsFollowing { get; set; }
You are welcome to use the DLL’s as they are. However, you are not allowed to disassemble the libraries without prior consent. You may not use these DLL’s for any commercial application without prior consent. All code within these DLL’s remain the property of Newbtech.
A fuller license agreement will be coming towards final release.
Josh Jun 30 2009 - 6:35 pm
Do you plan to add search anytime soon?
dee Jul 1 2009 - 1:11 am
once I come back from vacation.. :-)
Josh Jul 16 2009 - 8:41 am
Are you back from vacation yet?
Ryan Jul 23 2009 - 8:28 pm
@Josh: Don’t bother. This will never be complete. It’s pretty obvious.
Do Google for “Twitter C# class” and you’ll get lots of other options to get your job done.
I waited quite a while for this class but I’m on a deadline. Nice effort but no point if it is not followed through!
dee Jul 24 2009 - 9:04 am
@Ryan, I did say i had to go on vacation and will continue once I’m back. And this is a very early release.
If you saw the build list, you’d have noticed a release going out every couple of days.
I don’t have internet access where I went (much less power and water!).
I got back yesterday and will continue to work on this. This hasn’t been released on any published website apart from mine due to friends wanting this class.
Josh Aug 13 2009 - 7:14 am
Glad to see you have started working on it again. Keep up the good work.
dee Aug 13 2009 - 9:35 am
@Josh, no worries mate. I’ve just about got my Json and Atom helper classes set up as searching uses them instead of straight XML. Once its all tested, i’ll do another release.
Josh Aug 13 2009 - 9:43 am
Cool. Can’t wait.
dee Aug 13 2009 - 4:34 pm
@Josh, release 1.0.0.3 that has your search capability in it. I haven’t completely tested it yet, but its a start me thinks :)
-dee
Josh Aug 14 2009 - 5:47 pm
Search is working great. Keep up the good work.
dee Aug 14 2009 - 6:10 pm
@Josh, good to hear mate. Let me know if there is anything else you need in the wrapper. In the meantime, I need to get authorisation and json working lol
-dee.
Josh Aug 17 2009 - 3:19 pm
When you mention authorization, does this mean that requests will be charged to the user account instead of IPAddress?
dee Aug 17 2009 - 4:54 pm
requests should come through to the user account and not necessarily the ip address Josh…
Currently, the GetRateLimitStatus() method checks the user account (and not the IP Address). Next release, I’ll overload it to allow you to specify which rate limit to check so that you can see for yourself which limit is being affected.
-dee
Josh Aug 21 2009 - 10:06 am
Ok, I don’t know if this is some problem but I have 2 twitter accounts, and it doesn’t matter if i use one and then the other or just one for this but it gives me 417 errors. (The remote server returned an error: (417) Expectation Failed.)
Interface Twit = new Interface(“AccountName”, “AccountPassword”);
Followers TFollowers = Twit.GetFollowers();
Twit.SendTweet(“testing”);
I don’t know what causes this, but it sure gets annoying when I’M trying to search and respond to the tweets I want to.
dee Aug 21 2009 - 11:11 am
try including the following configuration in your app.config file:
Looks like some proxies out there may not like the expect100continue setting..
See if that helps.
Dee
Ron Oct 18 2009 - 8:58 am
hello,
Is there an option to receive a list of followers – for some user ?
(not my followers, other user – which I don’t have his password, only username)
Thanks,
Ron
dee Oct 18 2009 - 12:27 pm
@Ron,
At this point in time, I have not included that functionality as it may be open to data mining/abuse.
-dee-
Ron Oct 18 2009 - 11:19 pm
There is some Android-Twitter-Account with few hundreds of followers.
I would like to follow only few from that followers list,
since this is my Interest subject.
So, I need the account followers list (as a collection),
and from that collection, choose who to follow.
(according to my logic)
This is the reason that I need a user followers-List.
Is it possible to implement ?
Is there a twitter api for that ?
(I’m new to the twitter api)
Thanks again,
Ron
dee Oct 19 2009 - 3:16 pm
Hi Ron,
I’ve updated the API to version 1.0.0.4 that should implement what you need. I’ve published two new methods there, to firstly return back a list of follower id’s. And then for each id, you can retrieve each user’s details…
That should meet your requirements.
Be aware though: The retrieval list will try and return all the followers for a user and it can time out for large user sets.
-dee-