Skip to contents

Retrieves the configuration advertised by the current PXWeb base URL and language. Successful results are cached for this R session. A failed refresh returns the previous configuration with status = "stale"; without a cache, conservative defaults are returned. Offline mode never makes a request.

Usage

nso_api_config(refresh = FALSE)

Arguments

refresh

Logical. Bypass the session cache and request the configuration again. Has no network effect in offline mode.

Value

A list with numeric maxCells, maxValues, maxCalls, and timeWindow (seconds), plus origin ("server", "cache", or "defaults"), status ("available", "partial", "stale", "offline", or "unavailable"), base_url, and lang. Invalid or missing individual limits are replaced by conservative defaults and marked partial.

Details

maxCells limits cells in a data-query result. maxValues limits values returned per variable in table metadata; it is not a selection limit for data queries. maxCalls and timeWindow describe the server's advertised request allowance. The package separately applies at least one second between NSO request attempts, including retries. Calls on one computer coordinate through mongolstats.rate_limit_dir; computers sharing a public IP address require additional coordination by the caller.

References

PxWeb configuration manual, API feature, pages 74–75.

Examples

old <- nso_options(mongolstats.offline = TRUE)
nso_api_config()
#> $maxCells
#> [1] 1e+06
#> 
#> $maxValues
#> [1] 3000
#> 
#> $maxCalls
#> [1] 1
#> 
#> $timeWindow
#> [1] 1
#> 
#> $origin
#> [1] "defaults"
#> 
#> $status
#> [1] "offline"
#> 
#> $base_url
#> [1] "https://data.1212.mn/api/v1"
#> 
#> $lang
#> [1] "en"
#> 
options(old)