简体   繁体   中英

How to upload image to Twitter API in C#?

How can i upload a image to the Twitter API upload endpoint in C# but without any third party library? i already tried the code in this SO question How to post a tweet on my twitter account using C# and it works pretty well but it just tweet text, i know that i have to attach the "media_id" parameter but first i need to upload the image to twitter and thats the problem i have

what you need is how to send photos in a tweet, it might cause some other issues like Auth problems, twitter uses a parameter named media_ids twitter let you upload a photo to https://upload.twitter.com/1.1/media/upload.json url and get an ID back then use it for your tweet.

in this post it used the media and solved Auth problem with OAtuh: Adding media_ids to Twitter API call causes authentication issue

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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