I am trying to call this twitter v2 endpoint to hide a tweet using OAuth1 and ScribeJava
Here is what I have tried
val service = ServiceBuilder(apiKey)
.apiSecret(apiSecret)
.build(TwitterApi.instance())
val url = "https://api.twitter.com/2/tweets/${tweetId}/hidden"
val oauth1 = OAuth1AccessToken(token,secret)
val request = OAuthRequest(Verb.PUT, url)
request.setPayload("{ \"hidden\": true }")
service.signRequest(oauth1, request)
val response = service.execute(request)
When I try that I get a 400 Bad Request back, what is the proper way to do this?
The reason of your problem probably has to do with the fact that you are trying to hide a tweet that you do not have the ability to do so. Please, note the restrictions that a tweet must adhere to in order to be hidden. It is stated in the section
Step three: Find a Tweet ID to hidein the Twitter developer documentation: