curl--location--request GET 'https://api.twitter.com/2/tweets/search/all?query='
响应示例响应示例
200 - 示例 1
请求参数
Authorization
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token
示例:
Authorization: Bearer ********************
Query 参数
query
必需
One query/rule/filter for matching Tweets. Up to 1024 characters.
start_time
可选
YYYY-MM-DDTHH:mm:ssZ. The oldest UTC timestamp from which the Tweets will be provided. Timestamp is in second granularity and is inclusive (i.e. 12:00:01 includes the first second of the minute).
end_time
可选
YYYY-MM-DDTHH:mm:ssZ. The newest, most recent UTC timestamp to which the Tweets will be provided. Timestamp is in second granularity and is exclusive (i.e. 12:00:01 excludes the first second of the minute).
since_id
可选
Returns results with a Tweet ID greater than (that is, more recent than) the specified ID.
until_id
可选
Returns results with a Tweet ID less than (that is, older than) the specified ID.
max_results
可选
The maximum number of search results to be returned by a request.
next_token
可选
This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified.
expansions
可选
A comma separated list of fields to expand.
tweet.fields
可选
A comma separated list of Tweet fields to display.
user.fields
可选
A comma separated list of User fields to display.
media.fields
可选
A comma separated list of Media fields to display.
place.fields
可选
A comma separated list of Place fields to display.
poll.fields
可选
A comma separated list of Poll fields to display.
返回响应
🟢200Tweets full archive search response
application/json
Body
data
array[object (Tweet) {20}]
可选
>= 1 items
attachments
object
可选
Specifies the type of attachments (if any) present in this Tweet.
author_id
string
可选
Unique identifier of this User. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers.
示例值:
2244994945
正则匹配:
^[0-9]{1,19}$
context_annotations
array[object (ContextAnnotation) {2}]
可选
>= 1 items
conversation_id
string
可选
Unique identifier of this Tweet. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers.
示例值:
1346889436626259968
正则匹配:
^[0-9]{1,19}$
created_at
string<date-time>
可选
Creation time of the Tweet.
示例值:
2021-01-06T18:40:40.000Z
entities
object(FullTextEntities)
可选
geo
object
可选
The location tagged on the Tweet, if the user provided one.
id
string
必需
Unique identifier of this Tweet. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers.
示例值:
1346889436626259968
正则匹配:
^[0-9]{1,19}$
in_reply_to_user_id
string
可选
Unique identifier of this User. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers.
示例值:
2244994945
正则匹配:
^[0-9]{1,19}$
lang
string
可选
Language of the Tweet, if detected by Twitter. Returned as a BCP47 language tag.
示例值:
en
non_public_metrics
object
可选
Nonpublic engagement metrics for the Tweet at the time of the request.
organic_metrics
object
可选
Organic nonpublic engagement metrics for the Tweet at the time of the request.
possibly_sensitive
boolean
可选
Indicates if this Tweet contains URLs marked as sensitive, for example content suitable for mature audiences.
示例值:
false
promoted_metrics
object
可选
Promoted nonpublic engagement metrics for the Tweet at the time of the request.
public_metrics
object
可选
Engagement metrics for the Tweet at the time of the request.
referenced_tweets
array [object {2}]
可选
A list of Tweets this Tweet refers to. For example, if the parent Tweet is a Retweet, a Quoted Tweet or a Reply, it will include the related Tweet referenced to by its parent.
>= 1 items
reply_settings
enum<string>
可选
Shows who can reply a Tweet. Fields returned are everyone, mentioned_users, and following.
枚举值:
everyonementionedUsersfollowingother
正则匹配:
^[A-Za-z]{1,12}$
source
string
可选
The name of the app the user Tweeted from.
text
string
必需
The content of the Tweet.
示例值:
Learn how to use the user Tweet timeline and user mention timeline endpoints in the Twitter API v2 to explore Tweet\u2026 https:\/\/t.co\/56a0vZUx7i