Question posted 2013 ยท +6 upvotes
I have an API for my application which allows me to make cURL requests to it. I need to implement this into VBA so my desktop database can fire CURL requests to my web app.
curl -i --user [email protected]: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,
Accepted answer +14 upvotes
Solved it now guys, works well. For other peoples convenience.
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)
Access VBA objects referenced (3)
HTTPReq.Optionโ SolverOptions FunctionText0.Valueโ Cell Error ValuesText0.Valueโ Fill a Value Down into Blank Cells in a Column
Top access-vba Q&A (6)
- Create a query dynamically through code in MSAccess 2003 [VBA] +19 (2008)
- MS Access RunCode Macro cannot find my procedure +15 (2013)
- VBA: Why must I set focus to control every time? +15 (2013)
- Retrieve column values of the selected row of a multicolumn Access listbox +12 (2011)
- Loop through all unbound controls on a form and clear data +11 (2013)
- Passing arguments to Access Forms created with 'New' +9 (2014)
access-vba solutions on this site
.