kobo_api: Access to kobo-style APIs

View source: R/kobo_api.R

kobo_apiR Documentation

Access to kobo-style APIs

Description

The function provides a high-level access to APIs based on kobotoolbox. It parses the base URL for the ´api´ and returns the JSON response in a standard format.

Usage

kobo_api(
  path,
  api = c("humanitarian_response", "kobotoolbox"),
  auth_type = c("client", "token"),
  auth_key = NULL
)

Arguments

path

(character) additional path to based to the base API URL. It should start with a '/'.

api

(character) The type of API to be used or URL at which the API can be accessed. Can be either: - 'humanitarian_response': "https:://kobo.humanitarianresponse.info" will be used as the base URL (default) - 'kobotoolbox': "https:://https://kf.kobotoolbox.org" will be used as the base URL - 'custom': custom URL. Must at least start with "https://"

auth_type

(character) Two types of authentication are possible: - 'client': use the 'auth_key' 'user:password' to authenticate to the kobo API - 'token': uses the 'token' provided in 'auth_key' to authenticate

auth_key

(character) Can either be: - A combination of the kobo and password in format: 'user:password‘ (e.g. ’my_user:my_password') - A kobo API V2 token. See the https://support.kobotoolbox.org/api.html

Value

a 'kobo_api' object consisting of a list of: - 'content': parsed content from the request - 'path': - 'response': JSON response to request


ElliottMess/koboAPI documentation built on May 13, 2022, 3:49 p.m.