Sample code for 30+ languages & platforms
AutoIt

Clear All Multipart Parts

See more REST Examples

Demonstrates Rest.ClearAllParts, which removes all multipart subparts from the request under construction.

Background. Clearing the parts is useful when reusing the same Rest object to build a different multipart request.

Chilkat AutoIt Downloads

AutoIt
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

;  Build a part.
$oRest.PartSelector = "1"
$bSuccess = $oRest.SetMultipartBodyString("value1")
If ($bSuccess = False) Then
    ConsoleWrite($oRest.LastErrorText & @CRLF)
    Exit
EndIf

;  Remove all multipart subparts from the request under construction, for example before reusing the
;  same Rest object for a different multipart request.
$oRest.ClearAllParts()

ConsoleWrite("All multipart parts cleared." & @CRLF)