0

I am using a postman to test Twitter API v2, goal is to post a retweet and to delete a retweet. Somehow I am able to post a retweet but problem is that the retweet is empty. This is the Twitter API endpoint 'https://api.twitter.com/2/users/:id/retweets', ': id' is being replaced with my Twitter id. Authorization using OAuth 1.0, which works. And I am sending the 'twitter_id' id body as JSON data. Now what I get as a response is

{
    "data": {
        "retweeted": true
    }
}

so my question is how do I send a retweet text in this request because all Twitter is giving me for this post request is this endpoint I mentioned earlier.

Andy Piper
  • 11,422
  • 2
  • 26
  • 49
Edin Osmic
  • 374
  • 5
  • 25

2 Answers2

0

A Retweet does not include any text, it’s just an action on an existing Tweet, which is succeeding here.

You seem to be describing a Quote Tweet, where you re-post another Tweet with your own comment? To do that, you would take the URL of the existing Tweet, and use the Create Tweet endpoint to post a new Tweet containing your text, and the URL to the existing Tweet.

Andy Piper
  • 11,422
  • 2
  • 26
  • 49
  • No i am not talking about re-post, it's about reply, which is same as retweet, am i right? So when i open a tweet, i have an option which says "tweet your reply", which means a retweet? With this api i thought i can reply to the tweet. Thank you for helping. – Edin Osmic May 18 '22 at 10:04
  • I think i understand now, i am making a success with both of these two endpoints, POST 'https://api.twitter.com/2/users/:id/retweets' and DELETE 'https://api.twitter.com/2/users/:id/retweets/:source_tweet_id'. But its not really acheiving what i want, can you please tell me is there a way i can post a reply to a tweet, or reply to the reply, is there such an endpoint? – Edin Osmic May 18 '22 at 10:23
  • To post a reply, create a new Tweet and use the `reply` parameter with a reference to the ID of the Tweet you are responding to. – Andy Piper May 18 '22 at 13:23
  • For that i guess i need to use this endpoint "https://api.twitter.com/2/tweets"? Because i was already using it to post a tweet. but i didnt give any parameters so it was just a standard tweet. Can you be more specific about a reply parameter, because in postman when i put query parameter "reply" and give it a value of a tweet ID, i get this "message": "The query parameter [reply] is not one of [expansions,tweet.fields,media.fields,poll.fields,place.fields,user.fields]". Thank you. – Edin Osmic May 19 '22 at 06:32
  • I think now i understand much better what you are talking about but, still i don't understand how can i use reply parameter in a post tweet endpoint? – Edin Osmic May 19 '22 at 08:54
  • 1
    I find out how to do this. Endpoint for this action is "api.twitter.com/2/tweets", and parameters you have to pass are "text" and "reply" object with "in_reply_to_tweet_id" key, like this "reply: { in_reply_to_tweet_id: tweet_id } – Edin Osmic May 23 '22 at 10:34
0

What i wanted to actieve was this: Endpoint for this action is "api.twitter.com/2/tweets", and parameters you have to pass are "text" and "reply" object with "in_reply_to_tweet_id" key, like this "reply: { in_reply_to_tweet_id: tweet_id }

Edin Osmic
  • 374
  • 5
  • 25