4

I searched for this in the api docs and on this page but couldn't find any information:

I have an api token of a given user. Is there a way to find out whether this user has association bonus rights?

I know that I could just look whether a user has more than 200 rep on any site but this is error prone because one can also have the association bonus with less reputation when you lost it again.

5
  • MEE, please run this test for me. On Security you have only one rep but do have the association bonus. Please edit this post, if you can, to fix the formatting. Please let me know when you've made the attempt. There's some conflicting behavior/information at play here. Jan 12, 2019 at 19:21
  • @BrocAdams. I have only one rep due to a bounty. It shows the “needs be reviewed” warning when loading the editor. Have not tried to submit the edit yet, though. (So no insta-edit rights)
    – MEE
    Jan 12, 2019 at 19:39
  • Yes, I knew that was why you had the rep, and why I wanted to see if you could edit. The decree was that you would be able to, but the API suggested otherwise. Sorting it out and will answer this Q later (in between RL) if no one beats me to it. Jan 12, 2019 at 19:42
  • Mee, are you able to upvote a post on Security? Jan 12, 2019 at 20:54
  • @BrockAdams nope. It submits the anonymous feedback.
    – MEE
    Jan 12, 2019 at 21:23

1 Answer 1

3

Yes, you can find out if the user has received the association bonus using the API. It's a bit clunky though.

However, as we discovered, "association bonus rights" are rather meaningless at the moment. Otherwise, you'd be able to edit wikis, upvote, comment, and flag on Information Security Stack Exchange right now, despite currently only having 1 rep there.

If the association "rights" persisted, then you could use the API's /users/{id}/privileges route to see if you had, say, the Edit Community Wiki privilege despite not having 100 rep.

However, they currently do not stick, and I've created a bug report on Meta SE which you might want to review (and upvote).


Using the /users/{ids}/reputation-history route to see if the association bonus was given:

The /users/{ids}/reputation-history route will show if the user has received the association_bonus. Example:
    /reputation-history#ids=169072&site=security

Unfortunately, a user may have thousands of reputation events, and there is no way to filter, nor change the sorting of, that route's output.

Fortunately:

  1. Although the order can't be changed, the results do appear to be sorted by creation_date.
  2. In most cases, the user will get the bonus within the first 200, or so, events.

So, a recipe for seeing if the user has the bonus might go like this:

  1. Get the user's total number of events like:
    /2.2/users/331508/reputation-history?site=stackoverflow&filter=!--pn9sU*3FRx

    Result: ... "total": 7192

  2. Divide the total by 100 and add 1 to get the number of pages. In this case, 72.

  3. Fetch the last page like:
    /2.2/users/331508/reputation-history?page=72&pagesize=100&site=stackoverflow&filter=!9Z(-x-d4A

    Result: entry not yet present.

  4. If the results do not contain the association_bonus entry fetch the penultimate page:
    /2.2/users/331508/reputation-history?page=71&pagesize=100&site=stackoverflow&filter=!9Z(-x-d4A

    Result: association_bonus entry found.

  5. The association_bonus entry will almost always be there. If not, continue fetching pages off the end until you are satisfied.




Notes:

  1. The /users/{ids}/reputation route won't work because it only reports (some) rep changes associated with posts.
  2. There is no easy way to detect the bonus in SEDE.

You must log in to answer this question.

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