Querying a web service with vbscript (form post)

This is an example of calling a "web service" or "api" using VBScript. There are lots of different ways that people configure web services and integration apis.

This example is an example where essentially you are doing a remote "form post" to a web page using a complicate URL that has a bunch of URL query strings.

CODE BEGINS:

'Declare variables

Dim xml

Dim url

Dim response

Dim ourorderid

Dim theirorderid

Dim shipdate

Dim tracking

url = "http://integrationwebsite.com/store/lab//"

url =url & "?lab=myid&status=received&orderid=" & theirorderid & "&laborderid=" & ourorderid & "&access_token=xfdfd7738383833334443"

set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")

xmlhttp.open "POST", url, FALSE

xmlhttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"

xmlhttp.Send


'Now handle the response

response = xmlhttp.responseText

'then do something with response

'msgbox "Done"