https://developers.openapi.it/ and counter
I'm on vba.
I need to set my get statement, for https://developers.openapi.it/services/oauth#tag/counters
i just have email of my account and apykey
This is my code for all my get statement in general:
Option Explicit
Private Sub RestExample1()
Dim APICall As String
Dim myXML As New MSXML2.DOMDocument60
APICall = "https://oauth.openapi.it/counters/total/"
With CreateObject("MSXML2.XMLHTTP")
.Open "GET", APICall, False
.setRequestHeader "Authorization", "Basic xxxxxxxxxxxxxxxxxxxxxxxxxxx"
.send
Debug.Print .responseText
End With
End Sub
how to set the this:
.setRequestHeader "Authorization"
tks.
note:
for test i can send my account id and password
Hi sal21 ,
Looks like your API requires HTTP Basic authentication. It's a base64 encoded string, made up of your username + colon (:) + password, eg:
User = "josh"Password = "pa$$"
String = "josh:pa$$"
String after base64 encoding: "am9zaDpwYSQk"
Then the full header is:
"Authorization: Basic am9zaDpwYSQk"
I don't know VBA, but a Google showed this snippet, which may work for you...
user = "someusername" password = "somepassword" xmlhttp.setRequestHeader "Authorization", "Basic " + Base64Encode(user + ":" + password)
See: https://swagger.io/docs/specification/authentication/basic-authentication/ to learn about Basic Auth.