Sample code for 30+ languages & platforms
PowerBuilder

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

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Rest
integer li_BTls
integer li_BAutoReconnect

li_Success = 0

loo_Rest = create oleobject
li_rc = loo_Rest.ConnectToNewObject("Chilkat.Rest")
if li_rc < 0 then
    destroy loo_Rest
    MessageBox("Error","Connecting to COM object failed")
    return
end if
li_BTls = 1
li_BAutoReconnect = 1
li_Success = loo_Rest.Connect("example.com",443,li_BTls,li_BAutoReconnect)
if li_Success = 0 then
    Write-Debug loo_Rest.LastErrorText
    destroy loo_Rest
    return
end if

//  Build a part.
loo_Rest.PartSelector = "1"
li_Success = loo_Rest.SetMultipartBodyString("value1")
if li_Success = 0 then
    Write-Debug loo_Rest.LastErrorText
    destroy loo_Rest
    return
end if

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

Write-Debug "All multipart parts cleared."


destroy loo_Rest