since_id
and until_id
), both enterprise and v2 allow you to paginate using time (fromDate
and toDate
with enterprise, and start_time
and end_time
for v2).
Timezone
As noted in the pagination section, you can navigate different pages of data using time for both enterprise and v2. In both cases, you will be using UTC as the timezone when using these parameters.
Support for Post edit history and metadata
Both versions provide metadata that describes any edit history. Check out the search API References and thePost edits fundamentals page for more details.
http://gnip-api.x.com/search/30day/accounts/:account_name/:label.json
http://gnip-api.x.com/search/fullarchive/accounts/:account_name/:label.json
https://api.x.com/2/tweets/search/recent
https://api.x.com/2/tweets/search/all
id
and text
fields by default. To request any additional fields or objects, you will need to use the fields and expansions parameters. Any Post fields that you request from these endpoints will return in the primary Post object. Any expanded user, media, poll, or place objects and fields will return in an includes
object within your response. You can then match any expanded objects back to the Post object by matching the IDs located in both the Post and the expanded object.
We encourage you to read more about these new parameters in their respective guides, or by reading our guide on how to use fields and expansions.
In addition to the changes in how you request certain fields, X API v2 is also introducing new JSON designs for the objects returned by the APIs, including Post and user objects.
statuses
array, while X API v2 returns a data
array.contributors
and user.translator_type
are being removed.favorites
(in Post object) and favourites
(in user object), X API v2 uses the term like.null
) are not written to the payload. Post and user attributes are only included if they have non-null values.
reply_setting
field, which shows you who can reply to a given PostrequestParameters
object at the root level, which contains the parameters that you included in your request. The v2 version instead contains a meta
object that lives at the root level which includes the newest_id
, oldest_id
, result_count
, and next_token
if there is an additional page of results.
HTTP methods
The enterprise version of the API allows you to pass the request as either a POST HTTP method with a JSON body, or a GET HTTP method with a query string.
V2 only allows you to use the GET HTTP method with a query string.
Request time formats
The enterprise version of this endpoint uses the following date/time format in both the pagination parameters and the timePeriod
response field: YYYYMMDDHHmm
The v2 endpoint uses ISO 8601/RFC 3339 date/time format in both the pagination parameters and the start
and end
response fields: YYYY-MM-DDTHH:mm:ssZ
Request parameters
The following is a table of the request parameters for enterprise and X API v2:
Enterprise | Search Posts v2 |
---|---|
query | query |
maxResults | max_results |
fromDate (YYMMDDHHmm) | start_time (YYYY-MM-DDTHH:mm:ssZ) |
toDate (YYMMDDHHmm) | end_time (YYYY-MM-DDTHH:mm:ssZ) |
since_id | |
until_id | |
next | next_token or pagination_token |