Moving api calls to the client