Comparing Twitter API’s sample stream endpoints
The v2 sampled stream endpoint is replacing both the v1.1 statuses/sample and Labs sampled stream endpoint. If you have some code, apps, or tools that use an older version of the sample stream endpoint, and are considering migrating to the newer Twitter API v2 endpoint, then this set of guides is for you.
These guides will focus on the following areas:
- API request parameters - The Twitter API v2 endpoint introduces a new set of request parameters. While some parameters will be familiar, especially for those integrating with Labs, there are many important differences such as the introduction of the fields and expansions parameters.
- New JSON format - Twitter API v2 introduces a completely new JSON format. Any code that parses v1.1 standard, premium, and enterprise JSON payloads will need to be updated to work with the new formats.
- App and Project requirements - To access the Twitter API v2, you will need to use credentials from a developer App that is associated with a Project.
The following tables compare the various types of user lookup endpoints:
|Description||Standard v1.1||Labs v1||Twitter API v2|
|Authentication||OAuth 1.0a User Context||OAuth 2.0 Bearer Token||OAuth 2.0 Bearer Token|
|HTTP methods supported||GET||GET||GET|
|Default request rate limits||8 connection requests per minute||50 connection requests per 15 min||50 connection requests per 15 min|
|Maximum allowed connections||2||1||1|
|New JSON format||Native (soon to be referred to as 'legacy')||Labs v1 (determined by format: compact,default, detailed)||Twitter API v2 (determined by fields and expansions request parameters, not backward-compatible with v1.1 formats)|
|Supports selecting which fields return in the payload||No, data format pre-determined||✔||✔|
|Supports specifying the language of Tweets returned||✔|
|Supports the annotations field||✔||✔|
|Supports requesting specific metrics||✔|
|Supports the conversation_id field||✔|
|Requires the use of credentials from a developer App associated with a project||✔|