Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

I've seen a couple of StackApps that have the actual picture for the user profile. Is that coming from the API, and if so how? If not I'm assuming they are using some screen-scrapping to get that URL.

share|improve this question

2 Answers 2

up vote 5 down vote accepted

AFAIK StackExchange network uses gravatars. Hence you can get their profile picture from their email address (check the gravatar site for details).

share|improve this answer
    
Thanks that works great! –  Chris Nicol Oct 29 '11 at 15:52

Actually, the API does this already, and I'd prefer this method over using my email address. In fact, the reason for the Stack Exchange API is so that our apps don't have to rely on third parties that may break, change their APIs, misuse our data, or go away. Additionally, if your app doesn't need access to sending me emails, then I'd just prefer you not have my email address, as no one else on Stack Exchange has it.

http://api.stackexchange.com/2.1/users?order=desc&sort=reputation&inname=jmort253&site=stackoverflow&filter=!*MxL2GdM9OVn.VWD

The above is an example request, that uses my username instead, to retrieve my gravitar profile image. My email address isn't needed. You don't need to ask me for it at account creation in your app, which means I'm more likely to use your app.

In addition, it may be easier to pull these details by userId, such as this example:

http://api.stackexchange.com/2.1/users/552792?order=desc&sort=reputation&site=stackoverflow&filter=!*N1O2t9FKJv(Hwn5

{
  "items": [
    {
      "user_id": 552792,
      "user_type": "registered",
      "display_name": "jmort253",
      "profile_image": "http://www.gravatar.com/avatar/af668818d6cfecc1a1b008cf599562cd?d=identicon&r=PG",
      "reputation": 11660,
      "website_url": "http://blog.opensourceopportunities.com",
      "account_id": 265671
    }
  ],
  "quota_remaining": 9951,
  "quota_max": 10000,
  "has_more": false
}

To create your own /users filter, see the users API or the Users by ID API.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .