Getting started with the hide replies endpoint
This quick start guide will help you make your first request to the hide replies endpoint using Postman.
If you would like to see some code snippets in different languages, please visit the hide replies API Reference page.
For you to be able to complete this guide, you will have need to have a set of keys and tokens, which you can generate by following these steps:
- Apply for a developer account and receive approval.
- If you already have a developer account, activate the new developer portal.
- Create a Project and an associated developer App in the developer portal.
- Navigate to your app's “Keys and tokens” page, and save your API Keys, Access Tokens, and Bearer Token to your password manager.
Steps to build a PUT /tweets/:id/hidden request
Step one: Start with a tool or library
There are several different tools, code examples, and libraries that you can use to make a request to this endpoint, but we are going to use the Postman tool here to simplify the process.
To load Twitter API v2 Postman collection into your environment, please click on the following button:
Once you have the Twitter API v2 collection loaded in Postman, navigate to the hide replies endpoint.
Step two: Authenticate your request
To properly make a request to the Twitter API, you need to verify that you have permission to do so. To do this with the PUT /tweets/:id/hidden endpoint, you must authenticate your request with OAuth 1.0a User Context. The Postman collection is already configured to perform all the steps to generate the OAuth signature for you.
First, select Twitter API v2 from your environment dropdown in Postman. Edit the environment settings and add the following in the "Current Value" column:
- consumer_key with your OAuth Consumer Key
- consumer_secret with your OAuth Consumer Secret
- access_token with your OAuth Access Token
- token_secret with your OAuth Access Token Secret
Step three: Find a Tweet ID to hide
The hide replies endpoint can hide or unhide replies on behalf of an authorized user. Because we are using the Access Tokens related to your user profile in this example, you will be able to hide replies from users who participate in a conversation started by you. Similarly, if you were using Access Tokens that belong to another user that authorized your app, you would be able to moderate replies to any conversations started by that account.
Ask a friend to reply to a Tweet (let them know you're testing hide replies) or reply to any of your Tweets from a test account. Click on that reply, then copy the numeric part of its URL. That will be the Tweet ID we will hide.
In this case, we will be looking at the following Tweet, which has the ID
Step four: Hide the Tweet
In Postman, open the Hide replies folder and select Hide a reply. In the Params tab, paste the Tweet ID next to the id field (you won't need to replace :id in the URL). Click "Send" and you will see a successful response.
Step five: Unhide the Tweet
Hidden Tweets are moved to a separate tab in the Twitter app. To unhide a tweet in Postman, open the Hide replies folder and select Unhide a reply. In the Params tab, paste the same Tweet ID used in the previous step next into the id field. Click "Send" and you will see a successful response.
The hidden field represents the hidden status of the Tweet. A hidden status of true means the Tweet is hidden. Similarly, false means the Tweet is not hidden.