(C) Shopify Delete Product
Delete a product from the shop.
#include <C_CkRest.h>
#include <C_CkStringBuilder.h>
void ChilkatSample(void)
{
HCkRest rest;
BOOL success;
HCkStringBuilder sbResponse;
rest = CkRest_Create();
CkRest_SetAuthBasic(rest,"SHOPIFY_PRIVATE_API_KEY","SHOPIFY_PRIVATE_API_SECRET_KEY");
success = CkRest_Connect(rest,"chilkat.myshopify.com",443,TRUE,TRUE);
if (success != TRUE) {
printf("%s\n",CkRest_lastErrorText(rest));
CkRest_Dispose(rest);
return;
}
sbResponse = CkStringBuilder_Create();
success = CkRest_FullRequestNoBodySb(rest,"DELETE","/admin/products/#{id}.json",sbResponse);
if (success != TRUE) {
printf("%s\n",CkRest_lastErrorText(rest));
CkRest_Dispose(rest);
CkStringBuilder_Dispose(sbResponse);
return;
}
if (CkRest_getResponseStatusCode(rest) != 200) {
printf("Received error response code: %d\n",CkRest_getResponseStatusCode(rest));
printf("Response body:\n");
printf("%s\n",CkStringBuilder_getAsString(sbResponse));
CkRest_Dispose(rest);
CkStringBuilder_Dispose(sbResponse);
return;
}
printf("Example Completed.\n");
CkRest_Dispose(rest);
CkStringBuilder_Dispose(sbResponse);
}
|