2011-03-19 66 views
3

我在c#中试用twitter。Twitter,Oauth,关注用户

我与使用以下方法的Oauth工作提交新的鸣叫样本:

string xml = _oAuth.oAuthWebRequest(
       oAuthTwitter.Method.POST, 
       "http://twitter.com/statuses/update.xml", 
       "status="+tweet); 

我怎么会跟着用户?我在哪里可以找到对所有oAuthWebRequest可能性的支持,例如跟随用户,检查用户是否跟随我,取消关注用户。

由于事先

编辑:

我尝试以下按下列指示:http://www.lordyz.co.uk/2010/10/01/c-asp-net-twitter-api-oauth-example-continued/

串朋友= HttpUtility.UrlEncode( “LadyGaga的”);

string xml = _oAuth.oAuthWebRequest( 
    oAuthTwitter.Method.POST, 
    "http://api.twitter.com/1/friendships/create/" + friend + ".xml", ""); 

This Works!谢谢

回答

0

你应该使用这个REST调用 - https://api.twitter.com/1/friendships/create.xml 你应该通过POST发送你的数据。在您的示例中,您使用的是oAuthTwitter.Method.POST,但是您正在使用URL发送数据,而不是POST。

如果我没有理解oAuthWebRequest签名正确,那么你应该做这样的事情:

string friend = "ladygaga"; 
string xml = _oAuth.oAuthWebRequest(
        oAuthTwitter.Method.POST, 
        "https://api.twitter.com/1/friendships/create.xml", 
        "screen_name=" + friend);