Skip to contents

This function returns the base URL for the DHIS2 API from the provided auth object, or falls back to the global auth credentials if auth is not provided.

Usage

khis_base_url(auth = NULL)

Arguments

auth

(Optional) An auth object containing the DHIS2 credentials. If not provided, the function retrieves the base URL from the global auth object.

Value

The DHIS2 base URL as a string, or NULL if no credentials are available.

See also

Other credential functions: khis_cred(), khis_cred_clear(), khis_display_name(), khis_has_cred(), khis_username()

Examples


if (FALSE) { # \dontrun{
    # Set the credentials using the global .auth object
    khis_cred(username = 'DHIS2 username',
              password = 'DHIS2 password',
              base_url = 'https://dhis2-instance/api')

    # Retrieve the DHIS2 instance API base URL (expect 'https://dhis2-instance/api')
    khis_base_url()

    # Clear credentials
    khis_cred_clear()

    # Retrieve the base URL again (expect 'NULL')
    khis_base_url()
} # }