The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
An R client for Fieldclimate API
::install_github("basf/rfieldclimate") remotes
library("rfieldclimate")
rfieldclimate
uses HMAC
for authentication.
The public and private keys are read by default from environmental
variables FC_PUBLIC_KEY
and FC_PRIVATE_KEY
,
but you can provide them also in every function call using the
public_key=
and private_key=
arguments.
fc_request()
is the workhorse of this package.
With it you can query every API endpoint, e.g.
fc_request(method = "GET", path = "/system/types") %>%
head(2)
See the Routes
tables API
documentation for details. URL parameters must be included in the
path=
arguments, the request body in
body=
.
With fc_request()
all the api functionality can be
easily covered. Additionally, we provide some wrappers around
endpoints.
E.g. the wrapper for station information (see below) is defined as
fc_get_station#> function(station_id = NULL, ...) {
#> stopifnot(!is.null(station_id))
#> path <- file.path('/station', station_id)
#> fc_request(method = "GET", path = path, ...)
#> }
#> <bytecode: 0x55b67f00f260>
#> <environment: namespace:rfieldclimate>
For a few other endpoints wrapper functions are provided:
fc_get_user()
to list user informationfc_get_user_stations()
to list available stationsfc_get_station()
to get station informationfc_get_data()
to get data range of a stationfc_get_data_range()
to get data in rangeFeel free to add more wrappers (as described above).
We provide also convenience wrappers for objects, like
fc_parse_data()
to parse the object returned by
fc_get_data_range()
into a long format data.framefc_parse_stations()
to parse the object returned by
fc_get_user_stations()
into a data.frameTo run the full test suite with 100% coverage set valid environmental
variables FC_PUBLIC_KEY
and FC_PRIVATE_KEY
and
run devtools::test()
.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.