How do I get the Stack Overflow reputation of a specific user?

I am trying to show the Stack Overflow reputation of a user in my project. I have a user email. So with the user's email as input, can I get the user reputation on Stack Overflow?

Now I have tried using the Javascript SDK. The authentication method is used. In this case, the user has to login to Stack Overflow, after which I got the user ID and Stack Overflow reputation.

  • Can I get the Stack Overflow reputation of the user submitting his email address without authentication?
  • Every time his reputation changes on Stack Overflow, do I have the option to automatically update the Stack Overflow reputation value on my site?
+6


source to share


2 answers


For privacy reasons, email addresses are not available on the exchange-api stack. They are not available in either the data explorer or the database . As far as I know, you won't be able to query the database based on the email address.

With authentication, you can find the user by their id or by using the / me function .



As far as reputation updates go, I suppose you could use a cron job that updates the reputation daily.

Depending on how you want to represent reputation, you might also consider the Flair option , which is provided by Stack Exchange itself. Flairs are small images that display a user's resume and show his / her reputation. These styles are updated every 24-36 SE hours and can be accessed at the URL: https://stackoverflow.com/users/flair/user_id_here.png

+13


source


You can get user reputation via API:

https://stackoverflow.com/users/flair/<user_id>.json

      

and returns a json string (take yourself as an example)



{
  "id":7360676,
  "gravatarHtml":{},
  "badgeHtml":"<span title=\"2 silver badges\" aria-hidden=\"true\"><span class=\"badge2\">&#9679;</span><span class=\"badgecount\">2</span></span><span class=\"v-visible-sr\">2 silver badges</span><span title=\"9 bronze badges\" aria-hidden=\"true\"><span class=\"badge3\">&#9679;</span><span class=\"badgecount\">9</span></span><span class=\"v-visible-sr\">9 bronze badges</span>",
  "reputation":"456",
  "displayName":"Li Xin",
  "profileUrl":"https://stackoverflow.com/users/7360676/li-xin"
}

      

just read the reputation

return field of this API and you will get the user reputation

+2


source







All Articles