Move api functions to api/apiFunctions.php