Sunday, April 18, 2010

Get twitter user profile pic by name, unauthenticated

No javascript required. No server side component to deal with. Just drop the image tag in using this generic handler as the src:

http://api.twitter.com/1/users/profile_image/[SCREEN_NAME]

Replace "[SCREEN_NAME]" with the actual screen name and, voilĂ .

EX: <img src="http://api.twitter.com/1/users/profile_image/sdesapio">


 

2 comments:

  1. Anonymous12:16 AM

    Finally something that works!

    I have been looking at the twitter api docs, which have been pretty confusing. I am unable to understand what form of data they return.

    Sorry if it is a stupid question, but how is this api call working?
    what is the /1/ part for?
    Thank you. :)

    ReplyDelete
  2. RE: "...how is this api call working?"
    This is not really an API call. It's just a simple inline image request. I can't say with 100% certainty but, the "1" is probably just a URL trigger for redirection so the server knows what to do with the request.

    ReplyDelete