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 を持つ開発者アカウント
- App のベアラートークン (公開データ用) またはユーザーアクセストークン (非公開メトリクス用)
特定のポストにいいねしたユーザーの一覧を取得します。
curl "https://api.x.com/2/tweets/1354143047324299264/liking_users?\
user.fields=created_at,username,verified" \
-H "Authorization: Bearer $BEARER_TOKEN"
{
"data": [
{
"created_at": "2008-12-04T18:51:57.000Z",
"id": "17874544",
"username": "TwitterSupport",
"name": "Twitter Support",
"verified": true
},
{
"created_at": "2007-02-20T14:35:54.000Z",
"id": "783214",
"username": "Twitter",
"name": "Twitter",
"verified": true
}
],
"meta": {
"result_count": 2,
"next_token": "7140dibdnow9c7btw3z2vwioavpvutgzrzm9icis4ndix"
}
}
特定のユーザーが「いいね」した投稿を取得します。
curl "https://api.x.com/2/users/2244994945/liked_tweets?\
tweet.fields=created_at,public_metrics&\
max_results=10" \
-H "Authorization: Bearer $BEARER_TOKEN"
{
"data": [
{
"id": "1362449997430542337",
"text": "Honored to be the first developer to be featured...",
"created_at": "2021-02-18T17:45:00.000Z",
"public_metrics": {
"retweet_count": 5,
"reply_count": 2,
"like_count": 42,
"quote_count": 1
}
}
],
"meta": {
"result_count": 1,
"next_token": "7140dibdnow9c7btw4539n0vybdnx19ylpayqf16fjt4l"
}
}
expansions を使って、固定表示されたポストのような関連データを取得します:
curl "https://api.x.com/2/tweets/1354143047324299264/liking_users?\
user.fields=created_at&\
expansions=pinned_tweet_id&\
tweet.fields=created_at" \
-H "Authorization: Bearer $BEARER_TOKEN"
いいねを管理
投稿にいいねを付けたり取り消したりする
APIリファレンス
エンドポイントの完全なドキュメント