6

Using the notifications API, I can get everything that shows up in the achievements popover, except for reputation changes.
I can use reputation history for this, but it's per-site so would require a hit per site I was interested in.

Is there an API method I'm missing that would allow me to access reputation changes topbar-style, or are the reputation history endpoints my best option?

1 Answer 1

4

There is a related feature request for this. Go upvote it.

Meanwhile, one workaround is to:

  1. Poll the /users/{ids}/associated route (no more than once per minute). You can get up to 100 site's data in one API call.
  2. Record the reputation values for each site, and compare with the previous value.
  3. If the reputation has changed for a given site, call /reputation-history as desired to get more details as to why.
  4. Obviously this is not perfect as reputation changes that cancel each other out may not be detected. (And that's also a problem with the topbar change indicator.)


Sample /users/{ids}/associated route call:
/2.2/users/7545763/associated?page=1&pagesize=100 currently yields results like:

{ "items": [ {
      "badge_counts":       {"bronze": 3, "silver": 1, "gold": 0},
      "question_count":     0,
      "answer_count":       5,
      "last_access_date":   1569160287,
      "creation_date":      1466874855,
      "account_id":         7545763,
      "reputation":         162,          //  <====
      "user_id":            6512983,
      "site_url":           "https://stackoverflow.com",
      "site_name":          "Stack Overflow"
   }, {
      "badge_counts":       {"bronze": 5, "silver": 1, "gold": 0},
      "question_count":     1,
      "answer_count":       7,
      "last_access_date":   1568816203,
      "creation_date":      1462286084,
      "account_id":         7545763,
      "reputation":         206,          //  <====
      "user_id":            352714,
      "site_url":           "https://serverfault.com",
      "site_name":          "Server Fault"
    }, {
   // etc, etc...
1
  • 1
    Thanks for the detailed answer @awesome! I'm already using associated in a similar way, but I'm trying to avoid state. It will have to do for now.
    – gary
    Sep 22, 2019 at 15:04

You must log in to answer this question.

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