请注意: 本指南假定你已完成快速上手概览中的前提条件。
构建固定 List 查找请求的步骤
- 使用按用户名的 users lookup endpoint,传入一个用户名以获取返回中的 id 字段。
- 查看您的 Access Token,其中的数字部分即为您的用户 ID。
id
参数的“Value”列。
Key | Value |
id | 2244994945(用户 ID) |
id
和 name
。
如果希望获取除 id
和 name
之外的其他字段,需在请求中通过 field
和/或 expansion
参数进行指定。
在本练习中,我们将从不同对象请求三组额外字段:
- 主 List 对象中的附加字段
follower_count
。 - 使用 expansion 参数返回完整的 user object。
- 关联用户对象中的附加字段
tweet.created_at
。
Key | Value | 返回的字段 |
list.fields | follower_count | follower_count |
expansions | owner_id | includes.users.id, <br/>includes.users.name, <br/>includes.users.username |
user.fields | created_at | includes.users.created_at |
https://api.x.com/2/users/2244994945/pinned_lists?expansions=owner_id&list.fields=follower_count&user.fields=created_at
步骤四:发起请求并查看响应
完成所有设置后,点击“Send”按钮,您将收到与以下示例响应类似的结果: