How to send multiple key values in Authorization header with httpdownload

Dear SQL-coders,

Let’s assume you have to connect to a third party API such as l’addition that uses a bearer KEY and one ore more other application KEY(s) in the header to get your data.

Invantive SQL HttpDownload says:

but headers in HttpDownload is a string. And we need somehow an array, ie:

‘Authorization’: ‘Bearer 12345’
‘ApplicationKey’: ‘myPrivateKey’

But the GET to the endpoint will pass our header as a unique array to string converted blobed thing but how to pass that to our beloved Query Tool?

It is as simple as that:

select * 
from   httpdownload@DataDictionary
       ( url         => 'https://myniceurl.com'
       , contentType => 'application/json'
       , headers     => 'Authorization=Bearer 12345' || '&ApplicationKey=4878'
       , diskCache   => true
       , method      => 'GET'
       )

You’ll notice the notice & before the key following the Authorisation key.
You’ll notice also the space between the Bearer and the value itself. Leave it like this, it just works :slight_smile: (no need for urlencode())

Then you’re ready to parse the JSON content as described here or here by joining with the jsontable

We are now ready to connect to the API of l’addition a leading Saas restaurant solution nicely integrated with Adyen.

Great work! That is indeed a suitable approach to handle many API connections without OAuth flows and very complex rate limiters. Great! I have taken the liberty to upgrade the idea to a wiki, since it also includes a working solution.