Moved first api call so that it happens after the url is resolved