modified to call REST method from Controller.