Sample code for 30+ languages & platforms
Tcl

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 Tcl Downloads

Tcl

load ./chilkat.dll

set success 0

set rest [new_CkRest]

set bTls 1
set bAutoReconnect 1
set success [CkRest_Connect $rest "example.com" 443 $bTls $bAutoReconnect]
if {$success == 0} then {
    puts [CkRest_lastErrorText $rest]
    delete_CkRest $rest
    exit
}

#  Build a part.
CkRest_put_PartSelector $rest "1"
set success [CkRest_SetMultipartBodyString $rest "value1"]
if {$success == 0} then {
    puts [CkRest_lastErrorText $rest]
    delete_CkRest $rest
    exit
}

#  Remove all multipart subparts from the request under construction, for example before reusing the
#  same Rest object for a different multipart request.
CkRest_ClearAllParts $rest

puts "All multipart parts cleared."

delete_CkRest $rest