moved __call() method in Api to top in file