Sunday, October 25, 2009

Calling a REST Service from VB

I did not have much luck calling the Yahoo REST service, so I created my own web service using the MyEclipse tutorial and tested it out. The VB code to call the REST service is as follows:

Sub Macro1()

url = ""

Dim HttpReq As Object
Set HttpReq = New WinHttpRequest

HttpReq.Open "GET", url, False
'or use GET instead of POST

HttpReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

'HttpReq.send postmydata
'Note - if using GET set postmydata to ""

MsgBox (HttpReq.responseText)

End Sub

Now the next challange is to get the Microsoft XML parser working.

No comments:

Post a Comment

Solidworks macros eith ChatGPT

 Record a simple using thr Solidworks macro recorder, upload it to ChatGPT, and explain to ChatGPT how you want it changed:  https://youtu.b...