Add API tests and make them pass.

Added API tests (api_controller_spec) and API controller (events_controller).