Separated out functionality for requesting and decoding a url from the api.