Could anyone help me with setting up a login with the API Endpoint using VBA in Excel??
I can do the normal interactive login using
And then using the following in BeforeNavigate2
However using the API endpoint, I always get a fail with INPUT_VALIDATION_ERROR
I am calling a sendrequest function as
But have played around with putting username&password in the data of the send and various other things - all to no avail.
How should I be formatting this ??????
Thanks
I can do the normal interactive login using
Code:
ActiveSheet.WebBrowser1.Navigate "https://identitysso.betfair.com/view/login?product=APPKEY&url=https://www.betfair.com"
Code:
Dim lCount As Long
Dim lLen As Long
Dim strPostData As String
lLen = LenB(PostData) ' Use LenB to get the byte count
If lLen > 0 Then ' If it's a post form, lLen will be > 0
For lCount = 1 To lLen
strPostData = strPostData & Chr(AscB(MidB(PostData, lCount, 1))) ' Use MidB to get 1 byte at a time
Next
MsgBox strPostData
End If
However using the API endpoint, I always get a fail with INPUT_VALIDATION_ERROR
I am calling a sendrequest function as
Code:
strURL = "https://identitysso.betfair.com/api/login/"
strKey = "MYKEY"
Dim xhr
Set xhr = CreateObject("MSXML2.XMLHTTP")
With xhr
.Open "POST", strURL, False, "username=USERNAME", "password=PASSWORD"
.setRequestHeader "X-Application", strKey
.setRequestHeader "Accept", "application/json"
End With
xhr.send
SendRequest = xhr.responseText
But have played around with putting username&password in the data of the send and various other things - all to no avail.
How should I be formatting this ??????
Thanks



Comment