When retrieving history data through the JSON-RPC API, dealing with data from a wide lapse of time is painful because all the samples are returned, but it's very likely that I don't need such degree of detail.
Take, for example, a use case where I want to draw a chart for one year history. I will need, at most, one sample for each pixel of the chart's width, and not all history.
I propose creating an additional parameter to express the number of samples you want to get. It would divide the history in N groups of the same time length and return an average value for each group. It's different from the limit parameter, which only returns the first N rows of the history.
Since it's an important feature for me, I've started working on a patch that I'll upload here soon. I'm taking inspiration from frontend/php/include/classes/class.cchart.php, function selectData(), which is used to gather history data to build charts in the web frontend.