Performs GET
requests, with a built-in exponential backoff mechanism for retries
api_request(url, max_attempts = 3)
(character): URL to call.
(double, positive): specifies the maximum number of attempts to call the CoinGecko API (e.g., if the first call fails for some reason). Additional attempts are implemented with an exponential backoff. Defaults to 3.
A named list, the structure of which will vary depending on the
actual GET
request made.
This function only performs GET
requests. The url
is
expected to be built properly before passing onto this function.
The returned data are expected to be in JSON format. This function
will automatically parse the response object and return a named R list
with the respective elements. If no data can be retrieved (e.g. because
of a misspecified query parameter), the function will return nothing
(NULL
).