Sample code for 30+ languages & platforms
Visual FoxPro

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 Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loRest
LOCAL lnBTls
LOCAL lnBAutoReconnect

lnSuccess = 0

loRest = CreateObject('Chilkat.Rest')
lnBTls = 1
lnBAutoReconnect = 1
lnSuccess = loRest.Connect("example.com",443,lnBTls,lnBAutoReconnect)
IF (lnSuccess = 0) THEN
    ? loRest.LastErrorText
    RELEASE loRest
    CANCEL
ENDIF

*  Build a part.
loRest.PartSelector = "1"
lnSuccess = loRest.SetMultipartBodyString("value1")
IF (lnSuccess = 0) THEN
    ? loRest.LastErrorText
    RELEASE loRest
    CANCEL
ENDIF

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

? "All multipart parts cleared."

RELEASE loRest