Twitter Adds Quoted Tweet Data to APIs

Twitter has updated its APIs to include additional data associated with quoted tweets. Earlier this year, Twitter revised its Quote Tweet functionality, making it possible for users to comment on an existing tweet by embedding it as it appeared originally. Previously, the Quote Tweet button produced quoted text, creating a less-than-ideal experience that left users with limited space to add their own comments.

By adding quoted tweet data to API payloads for its streaming, REST and Gnip APIs, Twitter has given developers the ability to ensure that quoted tweets can be retrieved and displayed in the proper context. Developers using Twitter's streaming API will also be able to tap into new events when a tweet is quoted. This could be helpful for a variety of use cases. For instance, brands wanting to monitor the distribution of their content across Twitter can use the new streaming API events to be alerted when their tweets are quoted.

The API updates associated with quoted tweet data consist of three new JSON fields: a field containing the Tweet ID of the Quote Tweet, a field containing a string version of the quoted tweet and a field containing a full quoted tweet object. The last field includes all of the fields normally associated with a tweet API payload.

Developer Experience and API Design

Twitter's addition of quoted tweet data to its APIs is a good example of how API design affects developer experience. While the update itself is straightforward, it is well thought out.

In the interest of minimizing the size of API responses, Twitter could have opted to add a single field identifying the ID of the quoted tweet associated with a tweet being retrieved through its APIs. But that would have required that developers interested in the quoted tweet make a second call to retrieve the data for the quoted tweet. That would be even more inefficient and require that developers implement additional logic to deal with quoted tweets, so Twitter clearly took into account how developers building applications on its APIs would most likely want to access quoted tweet data.

This serves as a good reminder to companies that when developing and evolving APIs, it's important to think about real-world use cases, as seemingly subtle decisions can go a long way to determining whether APIs are developer-friendly and more likely to be used to their greatest potential.

Be sure to read the next API Design article: API Design Considerations for The Internet of Things

 

Comments (0)