R/get_quota.R

Defines functions get_remaining_quota

Documented in get_remaining_quota

#' Check Remaining Quota
#'
#' Query the API for the number of time series downloads remaining in the current month.
#' @inheritParams param_defs
#' @examples
#' get_remaining_quota("313984fcd9f343d3961891319b0ed321")
#' @import httr
#' @export
get_remaining_quota <- function(api_key) {

  query = list(apikey = api_key)

  response <- validate_response(GET("https://datenservice.kof.ethz.ch/api/v1/main/remainingquota", query = query))

  fromJSON(content(response, as="text"))$quota
}

Try the kofdata package in your browser

Any scripts or data that you put into this service are public.

kofdata documentation built on April 29, 2022, 9:06 a.m.