How to share a photo or link by using Twitter API instead of Twitter Card?

oauth
media-upload
api

#1

I am doing a small web game application and want my users to share the result picture(can be link) on Twitter. I have read the document a lot and found Twitter card was perfect. But Twitter card doesn’t work for my application Because there is not a proper DNS.

So my question is, Can I do it through Twitter API?

I tried the example in https://dev.twitter.com/rest/public/uploading-media . It worked well but I can only post image on my timeline. Can I use this API to post image on other people’s profile?


#2

@bianer233 Absolutely. Here are the steps:

  1. Upload image using (https://dev.twitter.com/rest/public/uploading-media) and receive a mediaId

  2. Call https://dev.twitter.com/rest/reference/post/account/update_profile_image with param “media_id={received_from_step_1}”. You don’t have to specify “image” param. Following is an example twurl command for step (2).

twurl -X POST “/1.1/account/update_profile_image.json” -d “media_id=700017999839784960”

We are going to update /1.1/account/update_profile_image.json api documentation to include media_id param.


#3