Chapter 8. Communication Through Tweets

In This Chapter

  • Working with" API communication methods

  • Update your Twitter status

  • Manage a user's timeline

  • More working examples of the API in PHP

This chapter covers API methods that allow users to communicate over Twitter. Communicating over Twitter involves consuming and creating tweets. Some ways you can work with tweets are by:

  • Updating your status

  • Sending a direct message

  • Favoriting a tweet

  • Searching for tweets

Status Methods

Status methods are methods that deal directly with tweets. They are used to create, delete, get details on, and retweet a tweet. There are six status methods, including:

  • statuses/show

  • statuses/update

  • statuses/destroy

  • statuses/retweet

  • statuses/retweets

Get the details of a specific tweet

You can get the complete details of a tweet and the user who wrote it with the statuses/show method.

This method doesn't require authentication, but to get the details of a protected Twitter account, you must

  • Authenticate your API call.

  • Have permission to view the protected account.

This method requires a GET request and is rate limited. Chapter 7 explains the concern with rate limits.


This method has two output formats:

  • XML

  • JSON

On a successful method call, it returns the complete status object, which contains the complete user object of the author.

If the tweet doesn't exist you will receive an error message and a HTTP status code of 404.


This method requires one parameter, the id of the tweet.

  • id: The numerical id of the status update.

    Example: ...

Get Twitter® Application Development for Dummies® now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.