Reputation: 1997
I have the id of a tweet that has been retweeted by the authenticated user.
How do I remove the retweet using Twitter4j?
Upvotes: 0
Views: 2076
Reputation: 3058
Unfortunately there is no direct way to remove a retweeted status. The feature is simply not implemented by the Twitter API.
One option is to remember all retweeted status IDs or you have to get all your retweets by calling getRetweetedByMe()
(Twitter API doc) and looping through the list.
Example:
List<Status> retweets = twitter.getRetweetedByMe();
for (Status retweet : retweets) {
if(retweet.getRetweetedStatus().getId() == ID_OF_TWEET_YOU_DONT_WANT_TO_RETWEET_ANYMORE)
twitter.destroyStatus(retweet.getId());
}
Upvotes: 4