Link to home
Start Free TrialLog in
Avatar of emeschke
emeschke

asked on

How do i send an api key in a request header

I'm using a service that provides an api to get data out of our online, hosted database. I've never called data this way from VBA and am wondering how to do it.
I have an api key, username, password but am not sure how to put code together to make it work.
Code I've put together is below:

Dim httpreq As New MSXML2.XMLHTTP60, myurl As String
myurl = "https://cowtown.breezechms.com/api/people"
httpreq.Open "GET", myurl, False
httpreq.setRequestHeader "Content-Type", "application/json"
httpreq.setRequestHeader "dduck", "abc123"
httpreq.send
MsgBox (httpreq.responseText)

The MsgBox just kicks back the following response.

"Permission Denied - API key () does not match subdomain (cowtown)"
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of emeschke
emeschke

ASKER

Thanks for your help.