Implement #477 : added stats json api by type and state

Here's the implementation of the stats API route. Let me know if you need anything else. ;)