The height parameter is for the height to start from. So if you wanted the last 1000 blocks it's be better to just to
http://chain.nem.ninja/api/stats/v2/blocktimes?numBlock=1000
If you don't provide a height you'll get the last numBlock of blocks :)
If you want the 100 blocks after height 1000 you'd do
http://chain.nem.ninja/api/stats/v2/blocktimes?height=1000&numBlock=100
Aha so the values in the output
{"blocktimes": [[1000, 27000], [999, 130000], [998, 67000],....
(1000,999,988...) are not block heights!
So blocks are requested from (height) -> (height + num) but output is sorted in reverse!
I get it now.
Ok thanks.
I can work further with this new API output but i must say i the older output format had one advantage
and this is that you can know exactly what block height had which block time value
and it was easier to spot error in the output for example a missing block or negative value
can be immediately linked to block of height (N) just by looking at the output.
Maybe would be good idea to make also the v2 API output
similar in a way that instead of showing 1000,999,988... the block height value is placed in array like:
{"blocktimes": [[44470, 27000], [44469, 130000], [44468, 67000],....
EDIT:
one small bug i found is that
the api call without any parameter http://chain.nem.ninja/api/stats/v2/blocktimes
returns last 117 blocktime values not 120 like the other api called without parameters.
The 117 error probably comes from the fact that redis doesn't "index" the real height...i can fix that if necessary.
I would have preferred to keep the old json format as well but dicts aren't sortable that's why I had to go with lists. It's the same format only the keys are not the first value of each dict and the value is the second.
I'll look into it though. Maybe there is a solution to keep the old format.