50% off | Unlimited Data & AI Learning

Last chance! 50% off unlimited learning

Sale ends in


r311 (version 0.4.3)

o311_ok: Is open311 API ok?

Description

Checks whether an open311 API mounted by o311_api is reachable and returns a valid requests response.

Usage

o311_ok(error = FALSE)

Value

A logical describing whether the API is reachable or not. If error = TRUE, returns the corresponding error object if one occurs.

Arguments

error

[logical]

Whether to return a logical or the error message describing why the API is not ok.

Examples

Run this code
# \donttest{
# check if Bonn API is reachable
o311_api("Bonn")
o311_ok()

# check if Helsinki API is reachable - fails
o311_add_endpoint(
  name = "Helsinki",
  root = "asiointi.hel.fi/palautews/rest/v1/"
)

o311_api("Helsinki")
o311_ok()

# return error message
try(o311_ok(error = TRUE))

# reset endpoints database
o311_reset_endpoints()
# }

Run the code above in your browser using DataLab