ChristianRookie
Hi,
I'm new to Bunq and wanted to play around with the API in the sanbox first. I'm an experienced developer but the documentation to me is not clear resulting in failed authentication.
The steps I performed so far is:
- Create a sanbox API in the developers portal (prefixed with sandbox_)
- Try to do an installation but this part fails, I used to code below but get the error '{"Error":[{"error_description":"Insufficient authentication.","error_description_translated":"Onvoldoende authenticatie."}]}'
`$requestUri = 'https://public-api.sandbox.bunq.com/v1/installation'
$headers = @{
'Content-Type' = 'application/json'
'X-Bunq-Client-Request-Id' = (New-Guid)
'User-Agent' = 'PowerShell'
'Cache-Control' = 'none'
'X-Bunq-Language' = 'nl_NL'
'X-Bunq-Region' = 'nl_NL'
'X-Bunq-Geolocation'= '0 0 0 0 000'
'X-Bunq-Client-Authentication' = $sanboxApiKey
}
$body = @{
'client_public_key' = $formattedPublicKey
}
$sanboxApiKey = Invoke-WebRequest -Method Post -Uri $requestUri -Headers $headers -body ($body | ConvertTo-Json -Depth 10)`
While the Quickstart - Opening a session refers to a 'Authorization' header I cannot find this in the installation POST instructions of the documentation page.
I also found a Bunq Together post from 2020 with a full cURL example, put this example uses an old endpoint 'sandbox-user' But when skipping to the installation step (I'm using the same headers and there is also no 'Authorization' header) it fails with the above error.
Can someone point me in the correct direction or a decent example of the entire flow needed to perform an installation and make a first API call to an endpoint.
Thank you!