Learn R Programming

kvkapiR (version 0.1.2)

kvk_search: Retrieve all results from the KvK Search API (up to 1,000 results)

Description

This function automatically paginates through the KvK API to collect available results. Due to API limitations, it retrieves a maximum of 1,000 records. When this happens, a warning will be displayed.

Usage

kvk_search(..., test_environment = FALSE)

Value

A tibble containing the retrieved results. Possible parameters can be found under the Results section of https://developers.kvk.nl/documentation/zoeken-api#output.

Arguments

...

Named arguments passed to the API query (e.g., naam = "Koudum"). Available arguments can be found at https://developers.kvk.nl/documentation/zoeken-api#input.

test_environment

A logical value. If TRUE, uses the test environment instead of the live API. Defaults to FALSE.

Details

If test_environment = TRUE, it switches to the KvK's test environment, using a mock API key for testing purposes.

Examples

Run this code
if (FALSE) { # nzchar(Sys.getenv("KVK_API_KEY"))
# Examples using the production API (requires API key)
koudum <- kvk_search(plaats = "Koudum")
print(koudum)

rotterdam <- kvk_search(plaats = "Rotterdam")
print(rotterdam)

# Examples using test environment (no API key required)
test_data <- kvk_search(plaats = "Utrecht", test_environment = TRUE)
print(test_data)
}

Run the code above in your browser using DataLab