Please note: This guide assumes you have completed the prerequisites from the quick start overview.
Steps to build a pinned List lookup request
Step one: Choose the List endpoint collection from Postman Once you have the X API v2 collection loaded in Postman, navigate to the “List” folder, select another folder “Pinned Lists”, and then choose “User’s pinned Lists”. Step two: Identify and specify the user In order to retrieve a user’s pinned List, you must specify their user ID within the request. The user ID must correspond to the authenticating user’s ID, meaning that you must pass the Access Tokens associated with the user ID when authenticating your request. In this example, you can specify the ID belonging to your own user. You can find your ID in two ways:- Using the users lookup by username endpoint, you can pass a username and receive the id field.
- Looking at your Access Token, you will find that the numeric part is your user ID.
id
parameter.
Key | Value |
id | 2244994945 (user ID) |
id
and name
.
If you would like to receive additional fields beyond id
and name
, you will have to specify those fields in your request with the field
and/or expansion
parameters.
For this exercise, we will request a three additional sets of fields from different objects:
- The additional
follower_count
field in the primary List object. - The full user object using the expansion parameter.
- The additional
tweet.created_at
field in the associated user object.
Key | Value | Returned fields |
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
Step four: Make your request and review your response
Once you have everything set up, hit the “Send” button, and you will receive a similar response to the following example response: