Complex Queries - Stack Exchange API

Complex Queries

Discussion

Simple usage of the 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 API provides the sort, min, max, fromdate, and todate parameters on many methods to allow for more complicated queries. min and max specify the range of a field must fall in (that field being specified by sort) to be returned, while fromdate and todate always define the range of creation_date. Think these parameters as defining two "windows" in which data must fit to be returned.

min, max, fromdate, and todate are inclusive.

Examples

Another handy trick is to only request the total field when all you care about is the quantity of items meeting some criteria, such as when calculating statistics. The ?filter=total built-in filter is provided for just this purpose.

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.