icesConnect provides GET, POST and PUT functions for users whishing to connect to ICES web services. The package provides the option to use tokens for ICES web services that require authentication and authorization. The token can be fetched using the users, username and password, or by setting the token manually.
icesConnect is implemented as an R package and available on CRAN.
icesConnect can be installed from CRAN using the install.packages
command:
install.packages("icesConnect")
For a summary of the package:
library(icesConnect)
?icesConnect
To perform a normal get request:
ices_get_jwt("https://taf.ices.dk/vms/api/gearwidths", jwt = "")
## GETing ... https://taf.ices.dk/vms/api/gearwidths
## no token used
## OK (HTTP 200).
## Response [https://taf.ices.dk/vms/api/gearwidths]
## Date: 2024-09-09 14:44
## Status: 200
## Content-Type: application/json; charset=utf-8
## Size: 3.72 kB
To perform a get request using a token, it is recommended to set your username first.
ices_get_jwt("https://taf.ices.dk/vms/api/gearwidths")
The first time this function is called, or if the curretnly stored token has expired the user will be asked to enter thier password. This password is the password use to access ICES resources, such as the ICES sharepoint.
icesConnect is developed openly on GitHub.
Feel free to open an issue there if you encounter problems or have suggestions for future versions.
The current development version can be installed using:
# Download and install icesConnect in R
install.packages(
"icesConnect",
repos = c(
icestoolsprod = "https://ices-tools-prod.r-universe.dev",
CRAN = "https://cloud.r-project.org"
)
)