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.
0x1F is an invalid start of a value
Learn Python: How to ignore SSL verification for HTTP requests
How to host your web site from your home
Automate testing of web page element transition with Selenium
Alert and Confirm pop up using BootBox in AngularJS
AngularJS Grouped Bar Chart and Line Chart using D3
How to lock and unlock account in Asp.Net Identity provider
2022 © Byteblocks, ALL Rights Reserved. Privacy Policy | Terms of Use