4

I am currently wanting to develop a webpage that displays my achievements in Stack Exchange.

Just the basic info... Badges earned, and reputation.

I am a beginner in Javascript. I reviewed the Javascript SDK briefly but cannot seem to get past the intro. Apparently, to access the information I need to have an access token to load the '/me' urls.

Here's a link to the api : https://api.stackexchange.com/docs/js-lib

Am I taking the right approach to this? All I need to load is the reputation and badges earned. And reload these values everytime the page is refreshed.

jsetting32
  • 1,632
  • 2
  • 20
  • 45
  • 1
    Do you want to use the api? What you describe sounds like the ready to use `flair` embeds you find on your profile page under the corresponding tab. – LJᛃ Dec 18 '14 at 15:12
  • Is this what you were talking about: http://stackoverflow.com/users/2086142/jsetting32/flair – jsetting32 Dec 18 '14 at 15:18
  • I think this only returns an img. This is a solution but I am wanting to pull the data and push it into a custom view I have within my web page – jsetting32 Dec 18 '14 at 15:19
  • Yes this was what I was talking about, and you're right its only an image. – LJᛃ Dec 18 '14 at 15:26
  • So without using the `flair` solution, will I have to dig into the API to fetch this information? – jsetting32 Dec 18 '14 at 15:27
  • 1
    Depending on your application of it you can skip authentication as you want to access public data. https://api.stackexchange.com/users/2086142?site=stackoverflow Note that there is a quota applied, so you would like to query and store the data on your server. See the [API overview for doc](https://api.stackexchange.com/docs) – LJᛃ Dec 18 '14 at 15:30
  • Oh wow... This is awesome... No need to fiddle with the API... Theres the url i needed!!! Thanks LJ – jsetting32 Dec 18 '14 at 15:31

1 Answers1

3

Thanks to LJ_1102, the problem is solved...

Heres the url I needed: https://api.stackexchange.com/users/2086142?site=stackoverflow

Which returns

{
    "items": [
        {
            "badge_counts": {
            "bronze": 45,
            "silver": 19,
            "gold": 2
            },
            "account_id": 2384980,
            "is_employee": false,
            "last_modified_date": 1577652604,
            "last_access_date": 1625099866,
            "reputation_change_year": 28,
            "reputation_change_quarter": 18,
            "reputation_change_month": 0,
            "reputation_change_week": 0,
            "reputation_change_day": 0,
            "reputation": 1602,
            "creation_date": 1361259689,
            "user_type": "registered",
            "user_id": 2086142,
            "accept_rate": 58,
            "location": "Petaluma, CA",
            "website_url": "http://spritebots.com",
            "link": "https://stackoverflow.com/users/2086142/jsetting32",
            "profile_image": "https://i.stack.imgur.com/dPs0T.jpg?s=256&g=1",
            "display_name": "jsetting32"
        }
    ],
    "has_more": false,
    "quota_max": 300,
    "quota_remaining": 227
}

Where keys badge_counts and reputation are what I need!

Gangula
  • 5,193
  • 4
  • 30
  • 59
jsetting32
  • 1,632
  • 2
  • 20
  • 45