2

Using the StackExchange API, it's possible to find out quite a bit about a user:

{
  "badge_counts": {
    "bronze": 3,
    "silver": 2,
    "gold": 1
  },
  "view_count": 1000,
  "down_vote_count": 50,
  "up_vote_count": 90,
  "answer_count": 10,
  "question_count": 12,
  "account_id": 1,
  "is_employee": false,
  "last_modified_date": 1625694512,
  "last_access_date": 1625737712,
  "reputation_change_year": 9001,
  "reputation_change_quarter": 400,
  "reputation_change_month": 200,
  "reputation_change_week": 800,
  "reputation_change_day": 100,
  "reputation": 9001,
  "creation_date": 1625694512,
  "user_type": "registered",
  "user_id": 1,
  "accept_rate": 55,
  "about_me": "about me block",
  "location": "An Imaginary World",
  "website_url": "http://example.com/",
  "link": "http://example.stackexchange.com/users/1/example-user",
  "profile_image": "https://www.gravatar.com/avatar/a007be5a61f6aa8f3e85ae2fc18dd66e?d=identicon&r=PG",
  "display_name": "Example User"
}

In addition, I would like to get the string you find next to your total reputation in the activity overview, e.g.,

top 5.43% this year

Is it possible to fetch this somehow using the API?

double-beep
  • 5,031
  • 17
  • 33
  • 41
Nico Schlömer
  • 53,797
  • 27
  • 201
  • 249

1 Answers1

2

Neither the SE API nor SEDE provide such field. Instead, you can

GET /users/rank?userId=<userId>

and then parse the HTML returned to get the percentage you want. For you (?user=353337), it looks like this:

<a href="https://stackexchange.com/leagues/1/year/stackoverflow/2021-01-01/353337#353337" target="_blank">top <b>0.20%</b> this year</a>
double-beep
  • 5,031
  • 17
  • 33
  • 41