AutoIt
AutoIt
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 AutoIt Downloads
Local $bSuccess = False
$oRest = ObjCreate("Chilkat.Rest")
Local $bTls = True
Local $bAutoReconnect = True
$bSuccess = $oRest.Connect("example.com",443,$bTls,$bAutoReconnect)
If ($bSuccess = False) Then
ConsoleWrite($oRest.LastErrorText & @CRLF)
Exit
EndIf
; FullRequestNoBodySb sends a request with no body and stores the text response body in a
; StringBuilder.
$oSbResponse = ObjCreate("Chilkat.StringBuilder")
$bSuccess = $oRest.FullRequestNoBodySb("GET","/api/items/123",$oSbResponse)
If ($bSuccess = False) Then
ConsoleWrite($oRest.LastErrorText & @CRLF)
Exit
EndIf
Local $sResponseText = $oSbResponse.GetAsString()
If ($oSbResponse.LastMethodSuccess = False) Then
ConsoleWrite($oSbResponse.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite($sResponseText & @CRLF)