Likes lookup: Standard v1.1 compared to X API v2
If you have been working with the standard v1.1 GET favorites/list endpoint, the goal of this guide is to help you understand the similarities and differences between the standard v1.1 and X API v2 Likes lookup endpoints.
With v2, we’ve also introduced a new liked users endpoint which allows you to get information about a Post's liking users.
- Similarities
- Authentiation
- Rate limits
- Differences
- Endpoint URLs
- Request limitations
- App and Project requirements
- Request parameters
- New JSON format
- Endpoint URLs
Similarities
Authentication
Both the standard v1.1 and X API v2 Likes lookup endpoints use OAuth 1.0a User Context or OAuth 2.0 Bearer Token. Therefore, if you were previously using the GET favorites/list endpoints standard v1.1 endpoints, you can continue using the same authentication method if you migrate to the X API v2 version if you wish.
Depending on your authentication library/package of choice, Bearer Token authentication is probably the easiest way to get started and can be set with a simple request header. To learn how to generate a Bearer Token, see this OAuth 2.0 Bearer Token guide.
Rate limits
The standard v1.1 GET favorites/list endpoint has a 75 requests per 15 minutes per user rate limit. The corresponding liked Posts endpoint in v2 also has this same rate limit. However, this v2 endpoint also has an additional rate limit of 75 requests per 15 minutes per App.
Differences
Endpoint URLs
- Standard v1.1 endpoints:
- GET https://api.x.com/1.1/favorites/list.json
(list of Posts which are by the specified user) - There is no v1.1 equivalent to the v2 liking users endpoint
- GET https://api.x.com/1.1/favorites/list.json
- X API v2 endpoint:
- GET https://api.x.com/2/users/:id/liked_tweets
(list of Posts which are liked by the specified user ID) - GET https://api.x.com/2/tweets/:id/liking_users
(list of users who liked the specified Post ID)
- GET https://api.x.com/2/users/:id/liked_tweets
Request limitations
The v2 liked Posts endpoint allows you to request 5 to 100 Posts per request, but you can request all likes of a Post using pagination tokens. The v1.1 GET favorites/list endpoint also allows you to pull all likes of Posts, but you can pull from 20 to 200 Posts per request.
For the v2 liking users endpoint, you are limited to 100 liking users per Post.
App and Project requirements
The X API v2 endpoints require that you use credentials from a developer App that is associated with a Project when authenticating your requests. All X API v1.1 endpoints can use credentials from standalone Apps or Apps associated with a project.
Request parameters
The following standard v1.1 request parameters accepted two request query parameters (user_id or screen_name). The X API v2 only accepts the numerical user ID, and it must be passed as part of the endpoint path.
One of the biggest differences between standard v1.1 and X API v2 endpoint versions is how you select which fields return in your payload. For the standard endpoints, there are several parameters that you could use to identify which fields or sets of fields would return in the payload, while the X API v2 version simplifies these different parameters into fields and expansions.
New JSON format
X API v2 is introducing new JSON designs for the objects returned by the APIs, including Post and user objects.
- At the JSON root level, the standard endpoints return user objects in a statuses array, while X API v2 returns a data array.
- Instead of referring to Retweeted and Quoted "statuses", X API v2 JSON refers to Retweeted and Quoted Tweets. Many legacy and deprecated fields, such as contributors and user.translator_type are being removed.
- Instead of using both favorites (in Post object) and favourites (in user object), X API v2 uses the term like.
- X is adopting the convention that JSON values with no value (for example, null) are not written to the payload. Post and user attributes are only included if they have non-null values.
In addition to the changes that we made to our new JSON format, we also introduced a new set of fields to the Post object including the following:
- conversation_id
- Two new Post annotations fields, including context and entities
- Several new metrics fields