How to add new twitter status message update using REST API

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

comments powered by Disqus

Search

Social

Weather

Monthly Posts