Zig
Zig
Shopify Delete Product
See more Shopify Examples
Delete a product from the shop.Chilkat Zig Downloads
const std = @import("std");
const chilkat = @import("chilkat");
pub fn main(init: std.process.Init) !void {
const alloc = init.arena.allocator();
const rest = try chilkat.Rest.init();
defer rest.deinit();
rest.setAuthBasic("SHOPIFY_PRIVATE_API_KEY", "SHOPIFY_PRIVATE_API_SECRET_KEY") catch {};
rest.connect("chilkat.myshopify.com", 443, true, true) catch {
std.debug.print("{s}\n", .{try rest.getLastErrorText(alloc)});
return;
};
const sb_response = try chilkat.StringBuilder.init();
defer sb_response.deinit();
rest.fullRequestNoBodySb("DELETE", "/admin/products/#{id}.json", sb_response) catch {
std.debug.print("{s}\n", .{try rest.getLastErrorText(alloc)});
return;
};
if (rest.getResponseStatusCode() != 200) {
std.debug.print("Received error response code: {d}\n", .{rest.getResponseStatusCode()});
std.debug.print("Response body:\n", .{});
std.debug.print("{s}\n", .{try sb_response.getAsString(alloc)});
return;
}
std.debug.print("Example Completed.\n", .{});
}