added api controller and some test methods