跳转到主要内容
请注意: 本指南假设你已完成快速上手概览中的前提条件。

构建 List 成员查询请求的步骤

步骤一:在 Postman 中选择 List endpoint 集合 在 Postman 中加载 X API v2 集合后,导航到“List”文件夹,选择其中的“List members”文件夹,然后选择“Members lookup”。 步骤二:确定并指定要检索成员的 List 你必须指定一个希望获取成员的 List。你可以通过访问 x.com,点击某个 List,然后查看 URL 来找到该 List 的 ID。例如,以下 URL 的 List ID 是 84839422。 https://x.com/i/lists/84839422 目标 ID 可以是任何有效的 List ID。在 Postman 中,导航到“Params”选项卡,将你的 ID 输入到路径变量 id 的“Value”列中。请确保在任何 ID 的前后都不要包含空格。
KeyValue
id84839422(List ID)
步骤三:确定并指定要检索的 fields 如果你在完成步骤三后点击“Send”按钮,你将在响应中收到默认的用户对象 fields:id、name 和 username。 如果你希望获取除 id、name 和 username 之外的其他 fields,需要在请求中通过 field 和/或 expansion 参数来指定这些 fields。 在本练习中,我们将从不同对象请求三组额外的 fields:
  • 主用户对象中的额外 user.created_at field。
  • 使用 expansion 参数请求完整的 Post 对象
  • 关联的 Post 对象中的额外 tweet.created_at field。
在 Postman 中,导航到“Params”选项卡,并在“Query Params”表中添加以下键值对:
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 步骤四:发起请求并查看响应 完成所有设置后,点击“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": "想要帮助构建一种新的社区驱动方式来应对误导性信息吗?加入我们——注册 Birdwatch!\n\nhttps://t.co/FSsqNznPy1"
      },
      {
        "created_at": "2021-10-21T17:29:07.000Z",
      "id": "1451239134798942208",
        "text": "时机已到——我们现在正在向所有 iOS 和 Android 用户推出主持 Spaces 的功能\n\n如果这是您第一次主持,欢迎!这里有使用方法的复习指南 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": "依然,我们翱翔\n\n...因为无论 2020 年试图击倒我们多少次,我们都重新站起来,以同理心、敏捷性、创新和领导力作出回应。\n\n在我们的 2020 年包容性与多样性年度报告中了解更多 #UntilWeAllBelong"
      }
    ]
  },
  "meta": {
    "result_count": 10,
    "next_token": "5349804505549807616"
  }
}
I