KoboClient | R Documentation |
A class to interact with the KoboToolbox API, extending crul::HttpClient
.
crul::HttpClient
-> KoboClient
new()
Initialization method for class "KoboClient".
KoboClient$new(base_url, kobo_token = Sys.getenv("KBTBR_TOKEN"))
base_url
character. The full base URL of the API.
kobo_token
character. The API token. Defaults to requesting
the system environment variable KBTBR_TOKEN
.
get()
Perform a GET request (with additional checks)
KoboClient$get(path, query = list(), ...)
path
character. Path component of the endpoint.
query
list. A named list which is parsed to the query component. The order is not hierarchical.
...
crul-options. Additional option arguments, see
crul::HttpClient
for reference
Extension of the crul::HttpClient$get()
method that checks
the HttpResponse object on status, that it is of type
application/json
, and parses the response text subsequently from
JSON to R list representation.
the server response as a crul::HttpResponse object.
post()
Perform a POST request
KoboClient$post(path, body, ...)
path
character. Path component of the endpoint.
body
R list. A data payload to be sent to the server.
...
crul-options. Additional option arguments, see
crul::HttpClient
for reference
Extension of the crul::HttpClient$post()
method.
Returns an object of class crul::HttpResponse
.
clone()
The objects of this class are cloneable with this method.
KoboClient$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.