Twitter Getting information about a tweet

Getting information about a tweet

Tweets in the Twitter API are referred to as status messages.

In Skybrud.Social the GetStatusMessage method lets you make a request to the API to get information about a given tweet. In it's simplest form, the method can be used by specifying the ID of the tweet:

// Make the call to the API
TwitterStatusMessageResponse response = service.Statuses.GetStatusMessage(610040220470349824);

// Write out some information about the tweet
Console.WriteLine(response.Body.Text);
Console.WriteLine(response.Body.User.ScreenName);
Console.WriteLine(response.Body.RetweetCount);

An overloaded version of the method lets you specify an instance of TwitterStatusMessageOptions instead. Generally the options you have here will limit the amount of information returned in the JSON from the API, so you won't need them in most cases.

The example below shows how to use the TwitterStatusMessageOptions - the properties have been defined with their standard values (equal to calling the overload described in the example above).

// Make the call to the API
TwitterStatusMessageResponse response = service.Statuses.GetStatusMessage(new TwitterStatusMessageOptions {
    Id = 610040220470349824,
    IncludeEntities = true,
    IncludeMyRetweet = true,
    TrimUser = false
});