Equivalent cURL in VBA?

I have an API for my application that allows me to make cURL requests. I need to implement this in VBA, so my desktop database can run CURL queries in my web application.

curl -i --user admin@admin.com :password -X PUT -d "test=testing" https://mywebsite.com/api 

How can I implement this in Access VBA? Can I use WinHttp.WinHttpRequest.5.1? Any examples? thanks Adam

+10
source share
1 answer

Decided now guys work well. For the convenience of other people.

 TargetURL = "https://www.mysite.co.uk/app/api/v1/test" Set HTTPReq = CreateObject("WinHttp.WinHttpRequest.5.1") HTTPReq.Option(4) = 13056 ' HTTPReq.Open "PUT", TargetURL, False HTTPReq.SetCredentials "user", "password", 0 HTTPReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" HTTPReq.send ("test[status]=" & Forms!curl!Text0.Value & "&test2[status]=" & Text2.Value) MsgBox (HTTPReq.responseText) 
+19
source

All Articles