Skip to main content
1 of 3
Sky Sanders
  • 12.1k
  • 3
  • 32
  • 60

page=0 count functionality implementation is inconsistent

consider:

http://api.stackoverflow.com/0.9/questions?page=0

{
  "total": 764951,
  "page": 0,
  "pagesize": 30,
  "questions": []
}

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

{
 "total": 1161,
 "page": 1,
 "pagesize": 30,
 "users": [
  {
   "user_id": 27284,
   "user_type": "registered",
   "creation_date": 1223858821,
   "display_name": "wcmiker",
   // blah blah blah
  },
  { 29 other users omitted}
 ]
}

The workaround seems to be to explicitly set page and pagesize to 0 whenever you want a count.

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

{
  "total": 1161,
  "page": 1,
  "pagesize": 0,
  "users": []
}

While this works just fine, a consistent api implementation that infers a count operation from page=0 alone would help provide a more consistent and concise api.

Sky Sanders
  • 12.1k
  • 3
  • 32
  • 60