Unicode C
Unicode C
CardConnect Delete Profile
See more CardConnect Examples
Demonstrates how to delete a profile.A DELETE request to the profile endpoint deletes the stored data for the specified profile ID. ...
See https://developer.cardconnect.com/cardconnect-api?lang=json#delete-profile-request
Chilkat Unicode C Downloads
#include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>
void ChilkatSample(void)
{
BOOL success;
HCkHttpW http;
const wchar_t *url;
const wchar_t *responseStr;
HCkJsonObjectW jsonResp;
success = FALSE;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttpW_Create();
CkHttpW_putBasicAuth(http,TRUE);
CkHttpW_putLogin(http,L"API_USERNAME");
CkHttpW_putPassword(http,L"API_PASSWORD");
url = L"https://<site>.cardconnect.com:<port>/cardconnect/rest/profile/<profile ID>/<account ID>/<merchid>";
responseStr = CkHttpW_quickDeleteStr(http,url);
if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
wprintf(L"%s\n",CkHttpW_lastErrorText(http));
CkHttpW_Dispose(http);
return;
}
// A response status of 200 indicates potential success. The JSON response body
// must be examined to determine if it was truly successful or an error.
wprintf(L"response status code = %d\n",CkHttpW_getLastStatus(http));
jsonResp = CkJsonObjectW_Create();
CkJsonObjectW_Load(jsonResp,responseStr);
CkJsonObjectW_putEmitCompact(jsonResp,FALSE);
wprintf(L"response JSON:\n");
wprintf(L"%s\n",CkJsonObjectW_emit(jsonResp));
// A successful response looks like this:
// {
// "respproc": "PPS",
// "resptext": "Profile Deleted",
// "respstat": "A",
// "respcode": "08"
// }
//
//
CkHttpW_Dispose(http);
CkJsonObjectW_Dispose(jsonResp);
}