Implement the full /stats http api call

Implements the full `/stats` http api call.