curl --request GET \
--url https://api.x.com/2/tweets/counts/recent \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.x.com/2/tweets/counts/recent"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.x.com/2/tweets/counts/recent', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.x.com/2/tweets/counts/recent",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.x.com/2/tweets/counts/recent"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.x.com/2/tweets/counts/recent")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.x.com/2/tweets/counts/recent")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"end": "2023-11-07T05:31:56Z",
"start": "2023-11-07T05:31:56Z",
"tweet_count": 123
}
],
"errors": [
{
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"status": 123
}
],
"meta": {
"newest_id": "<string>",
"next_token": "<string>",
"oldest_id": "<string>",
"total_tweet_count": 123
}
}{
"code": 123,
"message": "<string>"
}최근 포스트 수 가져오기
검색 쿼리와 일치하는 최근 7일간의 포스트 개수를 반환합니다.
curl --request GET \
--url https://api.x.com/2/tweets/counts/recent \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.x.com/2/tweets/counts/recent"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.x.com/2/tweets/counts/recent', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.x.com/2/tweets/counts/recent",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.x.com/2/tweets/counts/recent"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.x.com/2/tweets/counts/recent")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.x.com/2/tweets/counts/recent")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"end": "2023-11-07T05:31:56Z",
"start": "2023-11-07T05:31:56Z",
"tweet_count": 123
}
],
"errors": [
{
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"status": 123
}
],
"meta": {
"newest_id": "<string>",
"next_token": "<string>",
"oldest_id": "<string>",
"total_tweet_count": 123
}
}{
"code": 123,
"message": "<string>"
}인증
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
쿼리 매개변수
포스트를 매칭하기 위한 단일 쿼리/규칙/필터입니다. 최대 쿼리 길이 제한은 https://t.co/rulelength 를 참조하세요.
1 - 4096"(from:TwitterDev OR from:TwitterAPI) has:media -is:retweet"
YYYY-MM-DDTHH:mm:ssZ. 포스트가 제공될 수 있는 가장 이른 UTC 타임스탬프(최근 7일 이내)입니다. 타임스탬프는 초 단위까지의 정밀도를 가지며, 경계값을 포함합니다(예: 12:00:01은 해당 분의 첫 번째 초를 포함합니다).
YYYY-MM-DDTHH:mm:ssZ 형식입니다. 포스트를 제공할 기준이 되는 가장 최신 UTC 타임스탬프입니다. 타임스탬프는 초 단위 정밀도를 가지며 배타적(exclusive)입니다. (예: 12:00:01로 지정하면 12:00:01에 생성된 포스트는 포함되지 않습니다.)
지정된 id보다 큰(즉, 더 최신인) 포스트 id를 가진 결과를 반환합니다. 이 Tweet의 고유 식별자입니다. 일부 언어 및 도구에서 큰 정수를 처리하지 못해 발생하는 문제를 피하기 위해 문자열로 반환됩니다.
^[0-9]{1,19}$"1346889436626259968"
지정된 id보다 작은(즉, 더 오래된) 포스트 id를 가진 결과를 반환합니다. 이 Tweet의 고유 식별자입니다. 일부 언어 및 도구에서 큰 정수를 처리하지 못해 발생하는 문제를 피하기 위해 문자열로 반환됩니다.
^[0-9]{1,19}$"1346889436626259968"
이 매개변수는 다음 ‘페이지’의 결과를 가져오는 데 사용됩니다. 이 매개변수에 사용되는 값은 API 응답에서 그대로 전달된 것이며, 수정해서는 안 됩니다. base36 페이지네이션 토큰입니다.
1이 매개변수는 다음 ‘페이지’의 결과를 가져오는 데 사용됩니다. 이 매개변수에 사용되는 값은 API 응답에서 그대로 전달된 것이며, 수정해서는 안 됩니다. base36 페이지네이션 토큰입니다.
1검색 카운트 결과를 집계하는 단위입니다.
minute, hour, day 표시할 SearchCount 필드를 쉼표로 구분한 목록입니다. SearchCount 객체에서 사용할 수 있는 필드입니다.
1end, start, tweet_count ["end", "start", "tweet_count"]
응답
요청이 성공했습니다.
1Show child attributes
Show child attributes
1IETF RFC 7807(https://tools.ietf.org/html/rfc7807)에 정의된 HTTP Problem Details 객체
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
- Option 14
- Option 15
- Option 16
- Option 17
- Option 18
Show child attributes
Show child attributes
Show child attributes
Show child attributes