(Unicode C) Shopify Delete Product
Delete a product from the shop.
#include <C_CkRestW.h>
#include <C_CkStringBuilderW.h>
void ChilkatSample(void)
{
HCkRestW rest;
BOOL success;
HCkStringBuilderW sbResponse;
rest = CkRestW_Create();
CkRestW_SetAuthBasic(rest,L"SHOPIFY_PRIVATE_API_KEY",L"SHOPIFY_PRIVATE_API_SECRET_KEY");
success = CkRestW_Connect(rest,L"chilkat.myshopify.com",443,TRUE,TRUE);
if (success != TRUE) {
wprintf(L"%s\n",CkRestW_lastErrorText(rest));
CkRestW_Dispose(rest);
return;
}
sbResponse = CkStringBuilderW_Create();
success = CkRestW_FullRequestNoBodySb(rest,L"DELETE",L"/admin/products/#{id}.json",sbResponse);
if (success != TRUE) {
wprintf(L"%s\n",CkRestW_lastErrorText(rest));
CkRestW_Dispose(rest);
CkStringBuilderW_Dispose(sbResponse);
return;
}
if (CkRestW_getResponseStatusCode(rest) != 200) {
wprintf(L"Received error response code: %d\n",CkRestW_getResponseStatusCode(rest));
wprintf(L"Response body:\n");
wprintf(L"%s\n",CkStringBuilderW_getAsString(sbResponse));
CkRestW_Dispose(rest);
CkStringBuilderW_Dispose(sbResponse);
return;
}
wprintf(L"Example Completed.\n");
CkRestW_Dispose(rest);
CkStringBuilderW_Dispose(sbResponse);
}
|