Simple usage of the Stack Exchange API focuses around getting large sets of data about sites quickly. It's fairly obvious how to grab all of a user's answers, even all of a large set of users' via vectorized requests, all recent comments, and so on. What's less obvious is how to cull our datasets to smaller chunks of data.
The Stack Exchange API provides the
on many methods to allow for more complicated queries.
max specify the range of a field must fall in (that field being
sort) to be returned, while
todate always define the range of
Think these parameters as defining two "windows" in which data must fit to be returned.
todate are inclusive.
- All Stack Overflow Users Created on Feb. 27th of 2011
- Comments with at least a score of 10 on Ask Ubuntu
- Of these three posts on Server Fault, the one with the most recent activity
- Any favorites added in the month of December 2011 by Darin Dimitrov
- Questions created during the Modern Warfare 3 VS Skyrim Contest with the
skryimtag and a score greater than 10 on Gaming Stack Exchange
Another handy trick is to only request the
total field when all you care about is the quanity of items meeting some criteria, such as when calculating
?filter=total built-in filter is provided for just this purpose.