How to add new twitter status message update using REST API

by Viper 22. May 2009 11:47

In this code sample I will demonstrate how you can use twitter API to add a new status message to your account. In terms of Twitter API it is termed as Update of your status.


static void AddStausMessage(string msg)
{
 IFluentTwitter ft = FluentTwitter.CreateRequest();
 ft.AuthenticateAs(LOGIN_NAME, PASSWORD);
 ft.Statuses().Update(msg).AsJson();
 var resp = ft.Request();
 if (null != resp)
 {
  var status = resp.AsStatus();
  if (null != status)
  {
   Console.WriteLine("Status Id: {0}",status.Id);
   Console.WriteLine("Message: {0}", status.Text);
  }
 }
}

When API executes successfully it returns status object in response. I tested this method using this call AddStausMessage("Publishing more code samples showing to use Twitter API");. You can see this on my profile on twitter by clicking HERE

 

Views: 10740

Tags: ,

Twitter

blog comments powered by Disqus

Smart Phones Poll

What smart phone do you currently own?





Show Results

Month List

Powered by BlogEngine.NET 2.0.0.49
Theme by Naveen Kohli