What is the fastest way to check if a question is changed using the API calls?
For my purpose (a cache), a question is considered changed if:

  • A new comment is added to the question or to any of its answers
  • It had any new activity

What is the fastest way to get this check?

* the check should work also for questions with hundreds of answers

  • 1
    Of the 1,000,000+ questions on SO, less than a 100 have received more than 100 answers. Less than 1%, and that's assuming none of those answers were ever deleted. Its a really uncommon case, probably deserving of special treatment. The average question receives 2 answers, with over 80% of all questions receiving (again, assuming no deletions) 5 or fewer answers. Nov 1, 2010 at 3:06
  • The last such question asked was this one, which was closed. Policy has changed over SO's lifetime to strongly discourage such questions. Nov 1, 2010 at 3:09
  • @Kevin I just give up, too awkward to develop at the moment. Thanks for the stats. Nov 1, 2010 at 13:49
  • hey sys, as @kev says and as I have noticed, bloated answer/comment counts are rare. I would think that this is a pretty useful case even with the corners. If I get some time this week I will fire up the soapi.js2 dev and bang out an exemplar for future reference. Nov 1, 2010 at 14:39
  • @Sky keep in mind that bloated questions are the meat of StackPrinter. Nov 1, 2010 at 14:47

1 Answer 1


I have been working on another API recently so I may be a bit dull but my first impression is that the path of least resistance is to

  • pull your question(s) with answers and comments disregarding activity/creation filter (use max page size)
  • compare last activity date of the question. this will include new answers and edits on both the question and answers - if bumped you have your answer - pass go
  • compare comment count on the question and then each answer - if any have changed you have your answer - pass go
    • an obvious but unlikely hole here is if a comment is deleted and a comment is added resulting in an unchanged comment count. If this is a concern, compare comment_id

In terms of efficiency, this entails 1 (large payload) request and single iterated nested control structure for up to 100 questions *. One advantage is that if you pull with body=true, you already have your updated information.

Not as efficient as a last_activity_date that included comment activity but you work with what you have.

* This will likely break down for abnormal posts that contain >100 answers or posts with >100 comments. The only way I have found to fetch these is to perform distinct multipage pulls for answers and comments for each question, to which you would then apply the above criteria.

  • 1
    Thanks, here is my conclusion: too many steps to follow for something that should be straightforward instead. I give up for now, I really don't want wasting my time to build this kind of clunky check. Hope to see a good caching strategy provided by the API in the future. Nov 1, 2010 at 13:43

You must log in to answer this question.

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