Created an API controller with help of FOSRestBundle.