curl --request GET \
--url https://api.x.com/2/tweets/counts/all \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.x.com/2/tweets/counts/all"
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/all', 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/all",
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/all"
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/all")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.x.com/2/tweets/counts/all")
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>"
}全投稿数を取得する
フルアーカイブから、指定した検索クエリに一致する投稿数を取得します。
curl --request GET \
--url https://api.x.com/2/tweets/counts/all \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.x.com/2/tweets/counts/all"
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/all', 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/all",
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/all"
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/all")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.x.com/2/tweets/counts/all")
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 タイムスタンプです。タイムスタンプの粒度は秒で、両端を含みます(例: 12:00:01 はその 1 分間の最初の 1 秒を含みます)。
YYYY-MM-DDTHH:mm:ssZ。投稿が返される最新の UTC タイムスタンプです。タイムスタンプの粒度は秒で、上限側は排他的です(例: 12:00:01 はその 1 分間の最初の 1 秒を含みません)。
指定したIDより大きい(つまり、より新しい)ポストIDを持つ結果のみを返します。 このツイートの一意の識別子。大きな整数を扱えない言語やツールでの問題を避けるため、文字列として返されます。
^[0-9]{1,19}$"1346889436626259968"
指定したIDより小さい(つまり、より古い)ポストIDを持つ結果のみを返します。 このツイートの一意の識別子。大きな整数を扱えない言語やツールでの問題を避けるため、文字列として返されます。
^[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