Documentation Index
Fetch the complete documentation index at: https://generaltranslation.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
このガイドでは、X API を使用してブックマークした投稿を取得する手順を説明します。
前提条件開始する前に、次のものが必要です。
- 承認済みの App を持つ開発者アカウント
bookmark.read スコープを持つユーザーアクセストークン (OAuth 2.0 PKCE)
ブックマークをリクエストする
curl "https://api.x.com/2/users/2244994945/bookmarks?\
tweet.fields=created_at,public_metrics,author_id&\
max_results=10" \
-H "Authorization: Bearer $USER_ACCESS_TOKEN"
レスポンスを確認する
{
"data": [
{
"id": "1501258597237342208",
"text": "X API を使って構築したプロジェクトで、コミュニティと共有したいものはありますか?ぜひ教えてください!",
"created_at": "2024-01-15T10:30:00.000Z",
"author_id": "2244994945",
"public_metrics": {
"retweet_count": 15,
"reply_count": 8,
"like_count": 89,
"quote_count": 3
}
},
{
"id": "1501258542258348032",
"text": "これは、開発者のイノベーションが X をより良い場所にする方法の一例にすぎません…",
"created_at": "2024-01-15T09:15:00.000Z",
"author_id": "2244994945",
"public_metrics": {
"retweet_count": 22,
"reply_count": 5,
"like_count": 156,
"quote_count": 7
}
}
],
"meta": {
"result_count": 2,
"next_token": "7140dibdnow9c7btw4539n0vybdnx19ylpayqf16fjt4l"
}
}
expansions を使用して、ポストの投稿者に関するデータを取得します。
curl "https://api.x.com/2/users/2244994945/bookmarks?\
tweet.fields=created_at,author_id&\
expansions=author_id&\
user.fields=username,verified" \
-H "Authorization: Bearer $USER_ACCESS_TOKEN"
OAuth 2.0 PKCE を使用する場合、アクセストークンには次のスコープが付与されている必要があります。
| Scope | Description |
|---|
bookmark.read | ブックマークの読み取り |
tweet.read | ポストのデータの読み取り |
users.read | ユーザーデータの読み取り (expansions 用) |
APIリファレンス
エンドポイントの詳細なドキュメント