1

I want to use the API to get the sum of all scores of my answers to questions having a specific tag.

I started using top-user-answers-in-tags method, but it only returns the top 30, whereas I want them all.

1
  • 1
    Do you want upvotes (as stated in the title) or score (as stated in the body? They are not the same. The answer, below, uses score -- since that's what drives badges, privileges, etc. -- but it could easily switch to upvotes, except, that it's not always possible to tell which upvotes are Community Wiki (IE, don't count). Commented May 31, 2013 at 13:02

1 Answer 1

1

To do this you have to use the /users/{ids}/answers path to download all of a user's answers, and then filter out the tags and/or tot-up the scores from there.

Pseudo code:

scoreByTag = [] // Empty associative array

while (more pages of results) {
    1) Fetch next page of answers

    2) Store results and/or update scoreByTag array
}

Display/use select tag score(s) as desired.


Note that there is already a page that does this. It displays a user's tag scores for all his tags, with handy searching and sorting:

Score by tags page


Here's the results for your Stack Overflow account.

See, also How to filter getAnswersForUser by tag?, for a similar solution on the old API.

1
  • Thanks - this is perfect. I didn't realize you could use filters to get the tags in the response of the answers API.
    – RobSiklos
    Commented May 31, 2013 at 14:23

You must log in to answer this question.

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