Sample code for 30+ languages & platforms
Visual Basic 6.0

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 Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

Dim rest As New ChilkatRest
Dim bTls As Long
bTls = 1
Dim bAutoReconnect As Long
bAutoReconnect = 1
success = rest.Connect("example.com",443,bTls,bAutoReconnect)
If (success = 0) Then
    Debug.Print rest.LastErrorText
    Exit Sub
End If

'  FullRequestNoBodySb sends a request with no body and stores the text response body in a
'  StringBuilder.
Dim sbResponse As New ChilkatStringBuilder
success = rest.FullRequestNoBodySb("GET","/api/items/123",sbResponse)
If (success = 0) Then
    Debug.Print rest.LastErrorText
    Exit Sub
End If

Dim responseText As String
responseText = sbResponse.GetAsString()
If (sbResponse.LastMethodSuccess = 0) Then
    Debug.Print sbResponse.LastErrorText
    Exit Sub
End If

Debug.Print responseText