6

To get the count of a query without returning results, simply specify pagesize=0.

http://api.stackoverflow.com/0.9/users?filter=mike&sort=name&pagesize=0

{
  "total": 1161,
  "page": 1,
  "pagesize": 0,
  "users": []
}
6
  • 1
    Should be just pagesize=0. Deviations from this are bugs. Commented Jun 30, 2010 at 20:17
  • I thing dev-tips like these should be tagged support, not discussion. (Maybe both?)
    – jjnguy
    Commented Jul 26, 2010 at 13:14
  • @jjn - i think you are going to get pushback on tagging support. Typically support tag means, 'Hey, I need support', where as a devtip says 'Hey, here is some technical implementation information' . they are informational. perhaps the way to go is to add dev-tip to required tags so that it can stand alone Commented Jul 26, 2010 at 13:21
  • @code, well if you take the support tag at face-value, the word "support" means helping people use the API. That is exactly what dev-tip is doing. Just because a majority of support questions are "help my mouse is broken" doesn't mean it can't also be pre-emptive tips on how to better use the API.
    – jjnguy
    Commented Jul 26, 2010 at 13:33
  • @code, also, 'discussion' really fits horribly. There is really nothing to discuss about here. That is clearly the best way to get a result set size without pulling any data.
    – jjnguy
    Commented Jul 26, 2010 at 13:33
  • @jjn - ok, I can see that. I didn't see a clear choice when i tagged it as I did not want kevin to be deluged with 'help, my api is broken' false alarms. But a convention can be argued for support+devtip. I agree. now. Commented Jul 26, 2010 at 13:52

0

You must log in to answer this question.

Browse other questions tagged .