メインコンテンツへスキップ
ご注意: このガイドは、クイックスタートの概要に記載された前提条件を完了していることを前提としています。

List メンバー参照リクエストを作成する手順

ステップ1: Postman で List エンドポイントコレクションを選択 Postman に X API v2 コレクションを読み込んだら、“List” フォルダーに移動し、“List members” フォルダーを選択して、“Members lookup” を選びます。   ステップ2: 取得したい List を特定して指定 メンバーを取得したい List を指定する必要があります。x.com にアクセスして任意の List をクリックし、URL を確認すると List ID を見つけられます。例えば、次の URL の List ID は 84839422 です。 https://x.com/i/lists/84839422 対象 ID には有効な任意の List ID を使用できます。Postman で “Params” タブに移動し、id パス変数の “Value” 列にあなたの ID を入力します。ID の前後にスペースを入れないよう注意してください。
KeyValue
id84839422(List ID)
ステップ3: 取得したい fields を特定して指定 ステップ3の後に “Send” ボタンをクリックすると、レスポンスにはデフォルトの user object の fields(id、name、username)が返されます。 id、name、username 以外の fields も受け取りたい場合は、リクエストで fields および/または expansions パラメータを指定する必要があります。 この演習では、異なるオブジェクトから次の3つの追加 fields セットをリクエストします:
  • プライマリのユーザーオブジェクトにおける user.created_at の追加。
  • expansions パラメータを使用して Post object を完全に取得。
  • 関連する Post オブジェクトにおける tweet.created_at の追加。
Postman で “Params” タブに移動し、“Query Params” テーブルに次の key:value ペアを追加します:
KeyValueReturned fields
user.fieldscreated_atcreated_at
expansionspinned_tweet_idincludes.tweets.id, <br/>includes.tweets.text <br/>
tweet.fieldscreated_atincludes.tweets.created_at
これで “Send” ボタンの横に、次のような URL が表示されるはずです: https://api.x.com/2/lists/84839422/members?user.fields=created_at&expansions=pinned_tweet_id&tweet.fields=created_at ステップ4: リクエストを送信し、レスポンスを確認 すべての設定が完了したら、“Send” ボタンを押すと、次のサンプルレスポンスに類似したレスポンスが返ってきます。
{
  "data": [
    {
      "pinned_tweet_id": "1353789891348475905",
      "id": "1319036828964454402",
      "created_at": "2020-10-21T22:04:47.000Z",
      "name": "Birdwatch",
      "username": "birdwatch"
    },
    {
      "id": "1244731491088809984",
      "created_at": "2020-03-30T21:02:29.000Z",
      "name": "Twitter Thailand",
      "username": "TwitterThailand"
    },
    {
      "id": "1194267639100723200",
      "created_at": "2019-11-12T14:56:22.000Z",
      "name": "Twitter Retweets",
      "username": "TwitterRetweets"
    },
    {
      "id": "1168976680867762177",
      "created_at": "2019-09-03T19:59:02.000Z",
      "name": "Twitter Able",
      "username": "TwitterAble"
    },
    {
      "pinned_tweet_id": "1451239134798942208",
      "id": "1065249714214457345",
      "created_at": "2018-11-21T14:24:58.000Z",
      "name": "Spaces",
      "username": "TwitterSpaces"
    },
    {
      "id": "1049385226424786944",
      "created_at": "2018-10-08T19:45:09.000Z",
      "name": "Twitter Miami",
      "username": "TwitterMiami"
    },
    {
      "pinned_tweet_id": "1438533888498876420",
      "id": "1004367799588880384",
      "created_at": "2018-06-06T14:21:58.000Z",
      "name": "Twitter México",
      "username": "TwitterMexico"
    },
    {
      "pinned_tweet_id": "1370178223846297602",
      "id": "773578328498372608",
      "created_at": "2016-09-07T17:47:00.000Z",
      "name": "Twitter Together",
      "username": "TwitterTogether"
    },
    {
      "id": "766296039036948480",
      "created_at": "2016-08-18T15:29:47.000Z",
      "name": "Moments MENA",
      "username": "momentsmena"
    },
    {
      "id": "738118487122419712",
      "created_at": "2016-06-01T21:22:15.000Z",
      "name": "Twitter Asians",
      "username": "TwitterAsians"
    }
  ],
  "includes": {
    "tweets": [
      {
        "created_at": "2021-01-25T19:40:36.000Z",
        "id": "1353789891348475905",
        "text": "Want to help build a new community-driven approach to tackling misleading information? Join us — sign up for Birdwatch! \n\nhttps://t.co/FSsqNznPy1"
      },
      {
        "created_at": "2021-10-21T17:29:07.000Z",
        "id": "1451239134798942208",
        "text": "the time has arrived -- we’re now rolling out the ability for everyone on iOS and Android to host a Space\n\nif this is your first time hosting, welcome! here’s a refresher on how https://t.co/cLH8z0bocy"
      },
      {
        "created_at": "2021-09-16T16:03:00.000Z",
        "id": "1438533888498876420",
        "text": "Algunos le dicen amor, pero yo le digo:\n\n‌    ∧_∧  \n(。・ω・。)つ━☆・*\n⊂      ノ    ・゜+.\n しーJ   °。+ *´¨)\n         ☆ RECALENTADO ☆ \n#VivaMéxico"
      },
      {
        "created_at": "2021-03-12T01:01:59.000Z",
        "id": "1370178223846297602",
        "text": "Still, We Fly\n\n... because no matter how many times 2020 tried to knock us down, we got back up and responded with empathy, agility, innovation, and leadership.\n\nRead more in our 2020 Inclusion &amp; Diversity Annual Report #UntilWeAllBelong"
      }
    ]
  },
  "meta": {
    "result_count": 10,
    "next_token": "5349804505549807616"
  }
}