Sample code for 30+ languages & platforms
Java

Shopify Delete Product

See more Shopify Examples

Delete a product from the shop.

Chilkat Java Downloads

Chilkat2 Java
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.Rest;
import com.chilkatsoft.chilkat2.StringBuilder;

public class ChilkatExample {

    public static void main(String[] args) {
        Rest rest = new Rest();

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

        try {
            rest.connect("chilkat.myshopify.com", 443, true, true);
        } catch (ChilkatException e) {
            System.out.println(e.getLastErrorText());
            return;
        }

        StringBuilder sbResponse = new StringBuilder();
        try {
            rest.fullRequestNoBodySb("DELETE", "/admin/products/#{id}.json", sbResponse);
        } catch (ChilkatException e) {
            System.out.println(e.getLastErrorText());
            return;
        }

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

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