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>)}
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.
- I keep getting a 401 error with all these different combinations, and some give typeerrors depending on where in the request they're placed.
- The documentation isn't really useful. Here is the link.