Sample code for 30+ languages & platforms
Java

Shopify Delete Product

See more Shopify Examples

Delete a product from the shop.

Chilkat Java Downloads

Java
import com.chilkatsoft.*;

public class ChilkatExample {

  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
  }

  public static void main(String argv[])
  {
    boolean success = false;

    CkRest rest = new CkRest();

    rest.SetAuthBasic("SHOPIFY_PRIVATE_API_KEY","SHOPIFY_PRIVATE_API_SECRET_KEY");

    success = rest.Connect("chilkat.myshopify.com",443,true,true);
    if (success != true) {
        System.out.println(rest.lastErrorText());
        return;
        }

    CkStringBuilder sbResponse = new CkStringBuilder();
    success = rest.FullRequestNoBodySb("DELETE","/admin/products/#{id}.json",sbResponse);
    if (success != true) {
        System.out.println(rest.lastErrorText());
        return;
        }

    if (rest.get_ResponseStatusCode() != 200) {
        System.out.println("Received error response code: " + rest.get_ResponseStatusCode());
        System.out.println("Response body:");
        System.out.println(sbResponse.getAsString());
        return;
        }

    System.out.println("Example Completed.");
  }
}