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] FALSE
o311_api("Helsinki, FI")
o311_ok()
#> [1] TRUE
# check if Savonlinna API is reachable - should fail
o311_add_endpoint(
name = "Savonlinna, FI",
root = "https://savonlinna.asiointi.fi/eFeedback/api/georeport/v2"
)
o311_api("Savonlinna, FI")
# return error message
try(o311_ok(error = TRUE))
#> Error : ! Error code 400: An internal error occurred
# reset endpoints database
o311_reset_endpoints()
# }
