C
C
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 C Downloads
#include <C_CkRest.h>
void ChilkatSample(void)
{
BOOL success;
HCkRest rest;
BOOL bTls;
BOOL bAutoReconnect;
success = FALSE;
rest = CkRest_Create();
bTls = TRUE;
bAutoReconnect = TRUE;
success = CkRest_Connect(rest,"example.com",443,bTls,bAutoReconnect);
if (success == FALSE) {
printf("%s\n",CkRest_lastErrorText(rest));
CkRest_Dispose(rest);
return;
}
// Build a part.
CkRest_putPartSelector(rest,"1");
success = CkRest_SetMultipartBodyString(rest,"value1");
if (success == FALSE) {
printf("%s\n",CkRest_lastErrorText(rest));
CkRest_Dispose(rest);
return;
}
// 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);
printf("All multipart parts cleared.\n");
CkRest_Dispose(rest);
}