Learn R Programming

kvkapiR (version 0.1.2)

kvk_get_vestigingsprofiel: Retrieve the Vestigingsprofiel for a given establishment number

Description

This function retrieves the establishment profile (vestigingsprofiel) for a given establishment number (vestigingsnummer) using the KvK Vestigingsprofiel API.

Usage

kvk_get_vestigingsprofiel(
  vestigingsnummer,
  geoData = FALSE,
  test_environment = FALSE
)

Value

A tibble containing the retrieved establishment profile. If geoData = TRUE, the returned tibble will also include geographical information.

Arguments

vestigingsnummer

A string representing the establishment number for which the profile is requested.

geoData

A logical value indicating whether geo-data should be included in the response. Defaults to FALSE. If TRUE, the response will include geo-data.

test_environment

A logical value indicating whether to use the test environment (TRUE) or the production environment (FALSE). Defaults to FALSE.

Details

The function also supports the test_environment argument. When set to TRUE, the function will query the KvK test API environment, providing a set of fictitious test data.

The function retrieves data from the KvK Vestigingsprofiel API. If geoData = TRUE, geo-data (e.g., location data) will be included in the returned profile.

Important: If test_environment = TRUE, no actual API key is required. You will be using test data from the KvK test environment.

Examples

Run this code
if (FALSE) { # nzchar(Sys.getenv("KVK_API_KEY"))
# Examples using the production API (requires API key)
# Retrieve vestigingsprofiel for a given establishment number
vestigingsprofiel <- kvk_get_vestigingsprofiel(vestigingsnummer = "000038509504")
print(vestigingsprofiel)

# Retrieve vestigingsprofiel with geo-data
vestigingsprofiel_geo <- kvk_get_vestigingsprofiel(
  vestigingsnummer = "000038509504", 
  geoData = TRUE
)

# Examples using test environment (no API key required)
vestigingsprofiel_test <- kvk_get_vestigingsprofiel(
  vestigingsnummer = "000019716893", 
  test_environment = TRUE
)
print(vestigingsprofiel_test)
}

Run the code above in your browser using DataLab