Sample code for 30+ languages & platforms
C

Shopify Delete Product

See more Shopify Examples

Delete a product from the shop.

Chilkat C Downloads

C
#include <C_CkRest.h>
#include <C_CkStringBuilder.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkRest rest;
    HCkStringBuilder sbResponse;

    success = FALSE;

    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);

    }