(Bug 5137) Add basic support for new API

This adds register_api_endpoint functionality to the router and some
basic functions in an API controller.