How to verify if a twitter users is following a given user using REST API

by Viper 22. May 2009 12:53

This code sample will show how you can use Twitter REST API to verify if one twitter user is following a specified user or not. The use of this API is little tricky. It requires you to specify two screen names or IDs that you want to verify. There is Exists method on Friendships object in Tweetsharp API but it only takes one parameter. If you try to use the API just like that it will return error telling you that you need to specify two screen names or ids to verify. The use of this API is not very intutive. So I had to dig down into the code to figure out how it can be done. There is property VerifyScreenName on IFluentTwitterParameters. You have to set second screen name here. See how it is done in code below.


static void VerifyFriendShip(string screenName1, string screenName2)
{
 IFluentTwitter ft = FluentTwitter.CreateRequest();
 ft.AuthenticateAs(LOGIN_NAME, PASSWORD);
 ft.Friendships().Verify(screenName1);
 ft.Parameters.VerifyScreenName = screenName2;
 var resp = ft.Request();
 if (null != resp)
 {
  Console.WriteLine(resp);
 }
}

Return value from this API is true or false.

Views: 731

Tags: ,

Twitter

Comments

8/15/2009 12:26:26 AM #

Womens Fascino Diamond Stainless

Would you like to post a guest post on my blog?

Womens Fascino Diamond Stainless United States

8/18/2009 7:54:01 PM #

Rolex Oyster Perpetual Submariner

Tried to autotranslate you site not understand the writing any hope deutsch version?

Rolex Oyster Perpetual Submariner United States

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.5.1.7
Theme by Naveen Kohli