REST API v1
First, something changed in the Rest API for retrieving user images. This has happened in the past few days, without warning, unless I missed it.
The new format is:
It used to be:
This bit of the docs located here: https://dev.twitter.com/docs/api/1/get/users/profile_image/%3Ascreen_name
This method must not be used as the image source URL presented to users of your application.
Why not? What is the proposed solution, then, for displaying a user's image in browser? pre-fetching all images then returning the actual URL by reading the headers? That's ridiculous.
still no follow button on profile where it should be says edit profile tryed everything
when i am in myspace i click on my profile which is http://twitter.com/kimmeerkat that takes me to
twitter profile know my myspace profile is urlmyspace.com/571018965 how do i join these to things
together so people click on it from twitter to go to myspace i am trying my best i am sorry for all this
please help sara kim
The preferred URL format has changed though your older URLs will continue working for the foreseeable future. The changed format is clearer and
You are correct that you can't use these URLs in IMG SRC tags -- the reason is because they are API URLs and they count against rate limiting and go through the stack to be served. That does not scale. If you're using this method to obtain avatar image URLs you should cache the result. The URLs also invoke a redirect which is not a smart behavior to use for IMG SRC tags.
If you're showing avatars in the context of tweets, the avatar image URL is included in the embedded user object of the tweet. You can also get the current avatar image URL for the user by executing [node:66,title="users/show"] or [node:63,title="bulk users/lookup"]. This API method is most often used for backfilling, updated cached user data, and other indirect uses.
Hi Sara Kim,
This is a developer support site, not meant for general user support which you can find at http://help.twitter.com
I looked at your profile and saw that the URL you've put on your profile is your own Twitter URL. You'll want to change that to http://myspace.com/571018965 by editing your profile on https://twitter.com/settings/profile .. Your Twitter profile will then have a link to your Myspace profile.
Thanks for the info, @episod.
Interesting about the not scaling part... this is exactly how facebook delivers all of their images, and that seems to work fine, with no warnings not to do it: https://graph.facebook.com/eviljordan/picture?type=large
If I'm caching the images, though, what happens when the user updates their image? If I'm calling an image directly, I'll never know if it's been updated by just referencing the actual img src instead of calling the API.
I am not showing images in the context of tweets, but as user avatars for single sign on.
Now might be a good time to mention the undocumented size=original option, too.
1) Why is this undocumented?
2) When trying to access a size=original for a user that has protected their tweets, an api error is returned, instead of the link to the image, which differs from passing any other available size parameter. Example: http://api.twitter.com/1/users/profile_image?screen_name=DVDADO&size=original vs. http://api.twitter.com/1/users/profile_image?screen_name=DVDADO&size=normal
- Thanks for highlighting that. We'll add that in.
- What is the error that is returned? When I make a request for a protected users avatar it is returned for me.
When caching images it is up to you how long you wish to cache avatars for. In some cases developers prefer to synchronise once a day, other times they wait until the user signs in again. In either case you can always obtain the most up to data avatar (and other information) using the methods @episod described.
Hope that helps.
Man, you were on a posting reply binge!
This morning, I am getting an image rendered with text that says, 'The image "http://a3.twimg.com/sticky/default_profile_images/default_profile_4_original.png" cannot be displayed because it contains errors.' Seems like it should return a giant or normal size version of the Egg instead, no?
Last night, I was receiving an XML error response, which I stupidly didn't document.
Hello, I was doing some testing (i'm new with Twitter api)
I wanted to show all the profile images of a user.
Unfortunately I used this kind of URL https://dev.twitter.com/docs/api/1/get/users/profile_image/%3Ascreen_name ... rate limited.
I've read https://dev.twitter.com/docs/api/1/get/users/lookup and https://dev.twitter.com/docs/api/1/get/users/show but I'm not sure how to
- get all the followers of one user
- get the profile image of each follower
and be sure to not abuse the rate limit
How to be sure that I have not be blacklisted ?
This topic is now closed. New replies are no longer allowed.