stackoverflow api - get number of answers and questions per user

1.2k Views Asked by At

Is it possible to get the number of answers and questions the a user has made through the stack overflow api?

Currently, I have found a hacky way. It consists of getting the json response for user questions (or answers) and then counting the number of items in the array.

However, since that data is paginated, it requires multiple requests to count them all. Id rather find a way to get the count using only a single request.

Im getting my information from https://api.stackexchange.com/docs maby im missing something?

1

There are 1 best solutions below

0
On BEST ANSWER

There is an easier way to grab the number of questions or answers posted by a user.

You can use the filter=total query parameter, as explained in the documentation

The forms presented on the pages below do not indicate it but you can use the parameter with both questions and answers. See the links for examples of querying for the number of answers and questions for my account on stackoverflow: