ピン留めされたリストを取得する
1
自分のユーザーIDを取得する
認証済みユーザーの ID が必要です。ユーザールックアップエンドポイントを使うか、アクセストークンから確認できます (数値の部分がユーザーIDです) 。
2
ピン留めされたリストをリクエストする
cURL
3
レスポンスを確認する
利用可能なリストフィールド
次のステップ
ピン留め済みリストを管理
リストをピン留め・ピン留め解除する
リストのルックアップ
リストの詳細を取得
APIリファレンス
エンドポイントの詳細なドキュメント
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
ユーザーのピン留めされたリストを取得する
自分のユーザーIDを取得する
ピン留めされたリストをリクエストする
curl "https://api.x.com/2/users/2244994945/pinned_lists?\
list.fields=follower_count,member_count,owner_id&\
expansions=owner_id&\
user.fields=created_at,username" \
-H "Authorization: Bearer $USER_ACCESS_TOKEN"
from xdk import Client
client = Client(bearer_token="YOUR_USER_ACCESS_TOKEN")
# ピン留めされたリストを取得
response = client.lists.get_pinned(
"2244994945",
list_fields=["follower_count", "member_count", "owner_id"],
expansions=["owner_id"],
user_fields=["created_at", "username"]
)
for lst in response.data:
print(f"{lst.name} - {lst.follower_count} followers")
import { Client } from "@xdevplatform/xdk";
const client = new Client({ accessToken: "YOUR_USER_ACCESS_TOKEN" });
// ピン留めされたリストを取得
const response = await client.lists.getPinned("2244994945", {
listFields: ["follower_count", "member_count", "owner_id"],
expansions: ["owner_id"],
userFields: ["created_at", "username"],
});
response.data?.forEach((lst) => {
console.log(`${lst.name} - ${lst.follower_count} followers`);
});
レスポンスを確認する
{
"data": [
{
"id": "1454155907651158017",
"name": "Tech News",
"follower_count": 150,
"member_count": 25,
"owner_id": "2244994945"
}
],
"includes": {
"users": [
{
"id": "2244994945",
"username": "XDevelopers",
"name": "X Developers",
"created_at": "2013-12-14T04:35:55.000Z"
}
]
},
"meta": {
"result_count": 1
}
}
| Field | Description |
|---|---|
description | リストの説明 |
owner_id | 所有者のユーザーID |
private | リストが非公開かどうか |
member_count | メンバー数 |
follower_count | フォロワー数 |
created_at | リストの作成日時 |