background preloader

Twitter

Facebook Twitter

Cards

Oauth. Embed. List. Batch request for Timeline. API Limit. Twitter Streaming API Architecture. Search API. Site stream. Public stream. Certified Products. Blog. Frequently Asked Questions. Basics Did something change? The Twitter platform is constantly evolving and there is frequent change. If you have an integration that's no longer working, be sure and review the developer blog, platform calendar, recent tweets by the @twitterapi account, the API status dashboard, recently updated documentation and Twitter's status blog at How can I keep up with changes to the Twitter API?

There are a few great ways to follow the changes we make to the Twitter platform: How do I count out 140 characters? How do I obtain an API key? How do I properly navigate a timeline? How do I use the REST API over JSON-P? How do I use the Twitter platform? What does the retirement of API v1 entail? What is the version of the REST API? What kind of data can I get from the API?

What kind of data does the Twitter Platform capture? What's an API? What's the difference between User Streams and Site Streams? Why are embedded objects stale or inaccurate? Frequently Asked Questions. Basics Did something change? The Twitter platform is constantly evolving and there is frequent change. If you have an integration that's no longer working, be sure and review the developer blog, platform calendar, recent tweets by the @twitterapi account, the API status dashboard, recently updated documentation and Twitter's status blog at How can I keep up with changes to the Twitter API?

There are a few great ways to follow the changes we make to the Twitter platform: How do I count out 140 characters? How do I obtain an API key? How do I properly navigate a timeline? How do I use the REST API over JSON-P? How do I use the Twitter platform? What does the retirement of API v1 entail? What is the version of the REST API? What kind of data can I get from the API? What kind of data does the Twitter Platform capture? What's an API? What's the difference between User Streams and Site Streams? Why are embedded objects stale or inaccurate? The Streaming APIs. Updated on Mon, 2012-09-24 14:47 Overview The set of streaming APIs offered by Twitter give developers low latency access to Twitter's global stream of Tweet data.

A proper implementation of a streaming client will be pushed messages indicating Tweets and other events have occurred, without any of the overhead associated with polling a REST endpoint. Twitter offers several streaming endpoints, each customized to certain use cases. Differences between Streaming and REST Connecting to the streaming API requires keeping a persistent HTTP connection open. In many cases this involves thinking about your application differently than if you were interacting with the REST API. An app which connects to the Streaming APIs will not be able to establish a connection in response to a user request, as shown in the above example.

The streaming process gets the input Tweets and performs any parsing, filtering, and/or aggregation needed before storing the result to a data store. Public streams → User streams. Overview User Streams provide a stream of data and events specific to the authenticated user. Note that User Streams are not intended for server-to-server connections. If you need to make connections on behalf of multiple users from the same machine, consider using site streams. Connections Minimize the number of connections your application makes to User Streams.

Each Twitter account is limited to only a few simultaneous User Streams connections per OAuth application, regardless of IP. Once the per-application limit is exceeded, the oldest connection will be terminated. Your application must handle the HTTP 420 error code that indicates that the account has been logging in too often. Note that each application has its own allocation, so that logging in from App1 won't affect App2, and visa versa, but running too many copies of either App1 or App2 will cause problems. Applications that support simultaneous display of multiple Twitter accounts may open a connection per account. Replies. Site streams. Overview Site Streams allows services, such as web sites or mobile push services, to receive real-time updates for a large number of users. Events may be streamed for any user who has granted OAuth access to your application.

Desktop applications or applications with few users should use user streams. Site Streams is currently in a limited beta. Access is restricted to whitelisted accounts. Site streams messages Types of messages Site Streams deliver the same types of messages streamed to User Streams, with an additional wrapper indicating the user the message is targeted to. Data from accounts the user follows The with parameter controls the types of messages received. Protected data Site Streams may deliver both public and private data in a single stream. Data should be restricted by default, and only anonymously accessible if you can verify it to be public. These rules are covered in the Developer Rules of the Road. Connecting Limits Best Practices Be familiar with User Streams. POST statuses/filter.

Returns public statuses that match one or more filter predicates. Multiple parameters may be specified which allows most clients to use a single connection to the Streaming API. Both GET and POST requests are supported, but GET requests with too many parameters may cause the request to be rejected for excessive URL length. Use a POST request to avoid long URLs. The default access level allows up to 400 track keywords, 5,000 follow userids and 25 0.1-360 degree location boxes. Resource URL Parameters *Note: At least one predicate parameter (follow, locations, or track) must be specified. follow see note* A comma separated list of user IDs, indicating the users to return statuses for in the stream. GET statuses/user_timeline. Updated on Thu, 2013-03-07 10:38 Returns a collection of the most recent Tweets posted by the user indicated by the screen_name or user_id parameters.

User timelines belonging to protected users may only be requested when the authenticated user either "owns" the timeline or is an approved follower of the owner. The timeline returned is the equivalent of the one seen when you view a user's profile on twitter.com. This method can only return up to 3,200 of a user's most recent Tweets. See Working with Timelines for instructions on traversing timelines. See Embeddable Timelines, Embeddable Tweets, and GET statuses/oembed for tools to render Tweets according to Display Requirements. Resource URL Parameters Always specify either an user_id or screen_name when requesting a user timeline. user_id optional The ID of the user for whom to return results for. Example Values: 12345 screen_name optional Example Values: noradio since_id optional count optional.

User timeline RSS. Working with Timelines. Introduction The Twitter API has several methods, such as GET statuses/user_timeline, GET statuses/home_timeline and GET search/tweets, which return a timeline of Tweet data. Such timelines can grow very large, so there are limits to how much of a timeline a client application may fetch in a single request. Applications must therefore iterate through timeline results in order to build a more complete list.

Because of Twitter's realtime nature and the volume of data which is constantly being added to timelines, standard paging approaches are not always effective. The problem with "pages" In an ideal world, paging would be very easy to implement. The problem with this method is that Twitter timelines are constantly having new Tweets added to their front. In fact, if 5 or more Tweets were added between calls, subsequent calls would eventually retrieve all the Tweets returned from the first request - making an entire API request completely redundant. The max_id parameter. Rate Limiting. REST API Rate Limiting in v1.1. Per User or Per Application Rate limiting in version 1.1 of the API is primarily considered on a per-user basis — or more accurately described, per access token in your control.

If a method allows for 15 requests per rate limit window, then it allows you to make 15 requests per window per leveraged access token. This is similar to the way API v1 had per-user/per-access token limits when leveraging OAuth. When using application-only authentication, rate limits are determined globally for the entire application. If a method allows for 15 requests per rate limit window, then it allows you to make 15 requests per window — on behalf of your application. 15 Minute Windows Rate limits in version 1.1 of the API are divided into 15 minute intervals, which is a change from the 60 minute blocks in version 1.0. Search Search will be rate limited at 180 queries per 15 minute window for the time being, but we may adjust that over time. HTTP Headers and Response Codes GET and POST Request Limits Caching. REST API v1.1 Limits per window by resource.