Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

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.

share|improve this question
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). –  Brock Adams May 31 '13 at 13:02

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
Thanks - this is perfect. I didn't realize you could use filters to get the tags in the response of the answers API. –  RobSiklos May 31 '13 at 14:23

You must log in to answer this question.

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