get_metadata {khisr}R Documentation

Get Metadata from a KHIS

Description

get_metadata retrieves metadata for a specified endpoint of KHIS

Usage

get_metadata(
  endpoint,
  ...,
  fields = c("id", "name"),
  retry = 2,
  verbosity = 0,
  timeout = 60
)

Arguments

endpoint

The KHIS API endpoint for the metadata of interest (e.g. dataElements, organisationUnits).

...

One or more metadata_filter() params in key-value pairs.

fields

The specific columns to be returned in the tibble.

retry

Number of times to retry the API call in case of failure (defaults to 2).

verbosity

Level of HTTP information to print during the call:

  • 0: No output

  • 1: Show headers

  • 2: Show headers and bodies

  • 3: Show headers, bodies, and CURL status message.

timeout

Maximum number of seconds to wait for the API response.

Value

A tibble with the KHIS metadata response.

Examples



# Get the categories metadata
get_metadata('categories')

# Get the datasets metadata with fields 'id,name,organisationUnits' and filter
# only the datasets with id 'WWh5hbCmvND'
get_metadata('dataSets',
             fields = 'id,name,organisationUnits[id,name,path]',
             id %.eq% 'WWh5hbCmvND')

# Get data elements filtered by dataElementgroups id
get_metadata('dataElements',
             dataElementGroups.id %.eq% 'IXd7DXxZqzL',
             fields = ':all')


[Package khisr version 1.0.2 Index]