Unified api and view routes.

* Added common methods between api and routes.
* API data should now match view data