(Java) Shopify Delete Product
Delete a product from the shop.
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[])
{
CkRest rest = new CkRest();
boolean success;
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.");
}
}
|