简体   繁体   English

Twitter API 转推(回复)

[英]Twitter API post a retweet (reply)

I am using a postman to test Twitter API v2, goal is to post a retweet and to delete a retweet.我正在使用 postman 来测试 Twitter API v2,目标是发布转推和删除转推。 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.这是 Twitter API 端点 'https://api.twitter.com/2/users/:id/retweets',':id' 正在替换为我的 Twitter id。 Authorization using OAuth 1.0, which works.使用 OAuth 1.0 的授权,有效。 And I am sending the 'twitter_id' id body as JSON data.我正在发送 'twitter_id' id 正文作为 JSON 数据。 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.所以我的问题是如何在此请求中发送转推文本,因为所有 Twitter 都给我这个帖子请求是我之前提到的这个端点。

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.为此,您需要使用现有推文的 URL,并使用创建推文端点发布包含您的文本的新推文,并将 URL 发布到现有推文。

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 }我想要激活的是:这个动作的端点是“api.twitter.com/2/tweets”,你必须传递的参数是“text”和“reply”object,带有“in_reply_to_tweet_id”键,像这样“reply : { in_reply_to_tweet_id: tweet_id }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM