adding more functionality to api.php