3

I'm trying to use the reputation API to get the recent reputation delta for a given user. For example, looking at recent entries for /2.2/users/21539/reputation, one has:

{
    on_date: 1447018487,
    reputation_change: 2600,
    vote_type: "up_votes",
    post_type: "answer",
    post_id: 303231,
    user_id: 21539
}

It's showing a huge reputation change of 2600 for this answer, which is the total reputation gain since the answer was written in 2008 (10 x 260). Instead, I expected it to be just 10, for the upvote that happened on that one day.

Or am I misunderstanding the semantic of this field? If so, how would I get the recent delta, as is displayed on the reputation tab for a user?

1 Answer 1

3

It's a bit confusing but that is not a bug.
Think of it as, "Reputation change from when to when?"

Since you specified neither a fromdate, nor a todate, you are effectively asking for the changes for all time.

If you run the query for Nov 1, 2015 to Nov 9, 2015:

          /2.2/users/21539/reputation?fromdate=1446336000&todate=1447027200

You get:

"on_date": 1447018487,
"reputation_change": 10,
"vote_type": "up_votes",
"post_type": "answer",
"post_id": 303231,
"user_id": 21539

Which agrees with the timeline:

Reference:

See also, the /users/{ids}/reputation-history route.

3
  • 2
    Indeed, that works! So as I understand, it takes all the events for a given answer in the date range, and creates a single entry that is dated as the last event within the range. e.g. if the range is October 1 to 31, and a question gets an upvote on the 3rd, 10th and 17th, it'll show as a reputation_change of 30 on the 17th, Does that sound right? Commented Nov 10, 2015 at 19:39
  • 1
    Yes. And, a post will have a separate entry for each event type that occurred in that range. EG: up_votes (hint, hint :) ), bounties_won (wink & nudge), suggested_edits, etc. Commented Nov 10, 2015 at 19:46
  • Got it. Now here is the most meta link you'll see today: api.stackexchange.com/docs/… :) Commented Nov 10, 2015 at 20:48

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.