PHP code example of opengemeenten / kadaster-bag-api-client

1. Go to this page and download the library: Download opengemeenten/kadaster-bag-api-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

opengemeenten / kadaster-bag-api-client example snippets


    


onfigure API key authorization: apiKeyBAG
$config = Kadaster\BagApiClient\Configuration::getDefaultConfiguration()->setApiKey('X-Api-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Kadaster\BagApiClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Api-Key', 'Bearer');

$apiInstance = new Kadaster\BagApiClient\Api\AdresApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$zoekresultaat_identificatie = "zoekresultaat_identificatie_example"; // string | De identificatie van een gekozen zoekresultaat uit de  zoekResultatenHalCollectie verkregen bij een GET /adressen/zoek.
$postcode = "postcode_example"; // string | Postcode behorende bij een nummeraanduiding.
$huisnummer = 56; // int | Huisnummer behorende bij een nummeraanduiding.
$huisnummertoevoeging = "huisnummertoevoeging_example"; // string | Huisnummertoevoeging behorende bij een nummeraanduiding.
$huisletter = "huisletter_example"; // string | Huisletter behorende bij een nummeraanduiding.
$exacte_match = false; // bool | Een indicatie of de resultaten van een zoekoperatie exact overeen  moeten komen met de zoekcriteria, zie  [functionele specificatie exacte match](https://github.com/lvbag/BAG-API/blob/master/Features/exacte_match.feature).
$adresseerbaar_object_identificatie = new \Kadaster\BagApiClient\Model\AdresseerbaarObjectIdentificatie(); // \Kadaster\BagApiClient\Model\AdresseerbaarObjectIdentificatie | Identificatie van een adresseerbaar object uit de BAG.
$woonplaats_naam = "woonplaats_naam_example"; // string | Naam van een woonplaats.
$openbare_ruimte_naam = "openbare_ruimte_naam_example"; // string | Naam van een openbare ruimte.
$pand_identificatie = new \Kadaster\BagApiClient\Model\PandIdentificatie(); // \Kadaster\BagApiClient\Model\PandIdentificatie | De identificatie van een pand uit de BAG.
$expand = "expand_example"; // string | Hier kan aangegeven worden welke gerelateerde resources meegeladen moeten worden. Resources en velden van resources die gewenst zijn kunnen in de expand parameter kommagescheiden worden opgegeven. Specifieke velden van resource kunnen worden opgegeven door het opgeven van de resource-naam gevolgd door de veldnaam, met daartussen een punt.
$page = 1; // int | Pagina nummer
$page_size = 20; // int | Aantal resultaten per pagina
$q = "q_example"; // string | Zoekterm op postcode, woonplaats, straatnaam, huisnummer, huisletter,  huisnummertoevoeging.
$inclusief_eind_status = false; // bool | Een indicatie of ook actuele voorkomens met een eind status geleverd moeten worden.
$openbare_ruimte_identificatie = new \Kadaster\BagApiClient\Model\OpenbareRuimteIdentificatie(); // \Kadaster\BagApiClient\Model\OpenbareRuimteIdentificatie | De identificatie van een openbare ruimte uit de BAG.

try {
    $result = $apiInstance->bevraagAdressen($zoekresultaat_identificatie, $postcode, $huisnummer, $huisnummertoevoeging, $huisletter, $exacte_match, $adresseerbaar_object_identificatie, $woonplaats_naam, $openbare_ruimte_naam, $pand_identificatie, $expand, $page, $page_size, $q, $inclusief_eind_status, $openbare_ruimte_identificatie);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AdresApi->bevraagAdressen: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: apiKeyBAG
$config = Kadaster\BagApiClient\Configuration::getDefaultConfiguration()->setApiKey('X-Api-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Kadaster\BagApiClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Api-Key', 'Bearer');

$apiInstance = new Kadaster\BagApiClient\Api\AdresApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$nummeraanduiding_identificatie = new \Kadaster\BagApiClient\Model\NummeraanduidingIdentificatie(); // \Kadaster\BagApiClient\Model\NummeraanduidingIdentificatie | De identificatie van een nummeraanduiding uit de BAG.
$expand = "expand_example"; // string | Hier kan aangegeven worden welke gerelateerde resources meegeladen moeten worden. Resources en velden van resources die gewenst zijn kunnen in de expand parameter kommagescheiden worden opgegeven. Specifieke velden van resource kunnen worden opgegeven door het opgeven van de resource-naam gevolgd door de veldnaam, met daartussen een punt.
$inclusief_eind_status = false; // bool | Een indicatie of ook actuele voorkomens met een eind status geleverd moeten worden.

try {
    $result = $apiInstance->bevraagAdressenMetNumId($nummeraanduiding_identificatie, $expand, $inclusief_eind_status);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AdresApi->bevraagAdressenMetNumId: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: apiKeyBAG
$config = Kadaster\BagApiClient\Configuration::getDefaultConfiguration()->setApiKey('X-Api-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Kadaster\BagApiClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Api-Key', 'Bearer');

$apiInstance = new Kadaster\BagApiClient\Api\AdresApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$zoek = "zoek_example"; // string | Zoekterm op postcode, woonplaats, straatnaam, huisnummer, huisletter,  huisnummertoevoeging.
$page = 1; // int | Pagina nummer
$page_size = 20; // int | Aantal resultaten per pagina

try {
    $result = $apiInstance->zoek($zoek, $page, $page_size);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AdresApi->zoek: ', $e->getMessage(), PHP_EOL;
}