Nager.Date
Nager.Date copied to clipboard
Support for a GET ALL request
I am currently writing an R package that basically just makes requests to the API (I will link it when it is ready).
Here is an example of one the functions in the package:
#' function holidays: return all public holidays for a given country and year.
#' based on Nager Date API PublicHolidays V3
#' @param country_code: the country code.
#' @param year: the year you dates for.
#' @return a dataframe containing all public holidays for a given country and year
holidays <- function(country_code, year){
res <- GET(paste0("https://date.nager.at/api/v3/PublicHolidays/",year,"/",country_code))
data = fromJSON(rawToChar(res$content))
data <- to_snake(data)
return(data)
}
What I would like to do is create a function that returns a list of all public holidays for all countries, for a given year. I could do this by just calling the above function for each country that is supported by the API, but this would exceed the daily request limit.
Would a query like https://date.nager.at/api/v3/PublicHolidays/2021/ALL
be feasible to add?