Sample code for 30+ languages & platforms
VBScript

Send a Bodyless REST Request into a StringBuilder

See more REST Examples

Demonstrates Rest.FullRequestNoBodySb, which sends a request with no body and stores the text response body in a StringBuilder.

Background. This variant of the no-body full request writes the response into a StringBuilder rather than returning it as a string, which is convenient when the response will be further processed in place.

Chilkat VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

success = 0

set rest = CreateObject("Chilkat.Rest")
bTls = 1
bAutoReconnect = 1
success = rest.Connect("example.com",443,bTls,bAutoReconnect)
If (success = 0) Then
    outFile.WriteLine(rest.LastErrorText)
    WScript.Quit
End If

'  FullRequestNoBodySb sends a request with no body and stores the text response body in a
'  StringBuilder.
set sbResponse = CreateObject("Chilkat.StringBuilder")
success = rest.FullRequestNoBodySb("GET","/api/items/123",sbResponse)
If (success = 0) Then
    outFile.WriteLine(rest.LastErrorText)
    WScript.Quit
End If

responseText = sbResponse.GetAsString()
If (sbResponse.LastMethodSuccess = 0) Then
    outFile.WriteLine(sbResponse.LastErrorText)
    WScript.Quit
End If

outFile.WriteLine(responseText)

outFile.Close