I need to make an API call with http-kit in Clojure where it uses API-Key as authorization. That is, in Postman, you would usually have the option to add an api-key, api-value and the option to add it to header or query-params.
I know the following would be the way to go in case of basic-auth:
{:url "<api-url>"
:method :post
:headers {"Content-Type" "application/json"}
:basic-auth [<username> <password>]
:body <body>)}
But a similar variation isn't working with api-key version.
So far, I have tried:
{:basic-auth [<api-key> <api-value>]}
{:query-params {<api-key> <api-value>}}
{:query-params {:key <api-key>, :value <api-value>}}
{:headers {"Content-Type" "application/json"
<api-key> <api-value>}
{:api-key [<api-key> <api-value>]}
{:api-key {<api-key> <api-value>}
and other variations, but it doesn't seem to be working.
(Note: The authorization works on postman but I couldn't test the full api call there because the body is too long and too complex to copy, and the authorization isn't working from the application.)
If you submit a POST request in Postman with the API Key auth to a non-existent endpoint, the request will fail but you can still inspect the headers that were attempted in the request using the Console. I used placeholder values and the request headers looks like this:
This makes me think that with your request in http-kit needs at least a few of those headers (typically you'll need at least
Content-type,Acceptand your custom API key/value pair).