Fix obtaining the api URL between functions