My problem is similar. I am trying to convert a cURL commands to VBA. This is the first GET that initiates retrieving up to 200 records in JSON format.
Code:
cURL.exe --request GET --Url 'mywebaddress' --user 'myemailaddress.com:mytoken' --header 'Accept: application/json'
The following returns a status 403 Unauthorized. I haven't been able to figure out how to get it to work.
Code:
Dim objHTTP As Object
Dim sUrl As String
Dim sStatus as String
sUrl = "mywebaddress"
Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
With objHTTP
.Open "GET", sUrl, False
.SetCredentials "myemailaddress", "mytoken", 0
.setRequestHeader "Accept", "application/json"
.send
End With
sStatus = objHTTP.status
Then a GET is executed in loop to retrieve all the rest of the data, 200 records at a time. The only difference is adding a couple options to the web address.
Lastly, I execute the DELETE cURL against each user to uncheck them from being active users.
Code:
cURL.exe --request DELETE --url 'myotherwebaddress' --user 'myemailaddress:mytoken' --header 'Accept: application/json'
I've spent many hours googling and trying to find the solution. Hopefully someone can help me. Thanks