Checks whether an open311 API mounted by o311_api
is reachable
and returns a valid requests response.
Value
A logical describing whether the API is reachable or not.
If error = TRUE
, returns the corresponding error object if one
occurs.
Examples
# \donttest{
# check if Bonn API is reachable
o311_api("Bonn")
o311_ok()
#> [1] TRUE
# check if Helsinki API is reachable - fails
o311_add_endpoint(
name = "Helsinki",
root = "asiointi.hel.fi/palautews/rest/v1/"
)
o311_api("Helsinki")
o311_ok()
#> [1] FALSE
# return error message
try(o311_ok(error = TRUE))
#> <o311_type_error in check_content_type(resp, type): Unexpected content type “text/html; charset=UTF-8”>
# reset endpoints database
o311_reset_endpoints()
# }