public/Get-OpenKVKSuggestion.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function Get-OpenKVKSuggestion {
    [cmdletbinding()]
    param(
        [parameter(Mandatory=$False)]
        [ValidateCount(1,25)]
        [int]$Size = 10,
        [parameter(Mandatory=$False)]
        [String]$Query
    )

    Begin {
        $headers = @{
            'ovio-api-key' = $OverheidIO_APIKey
        }

        $APIEndpoint = "/suggest/openkvk/"

        $URL = $OverheidIO_APIHost + $APIEndpoint + $Query + "?size=$Size" + "&fields[]=handelsnaam" + "&fields[]=dossiernummer"

    }

    Process {
        Write-Debug "Making a request to the following URL: $URL"
        $Response = Invoke-RestMethod -Method GET -Uri $URL -Headers $headers
    }

    End {
        return $Response.handelsnaam
    }
}