Zig
Zig
Shopify Basic Authentication: Get List of Products
See more Shopify Examples
Demonstrates how to send a simple HTTP GET request with Basic authentication to get a list of products.Chilkat Zig Downloads
const std = @import("std");
const chilkat = @import("chilkat");
pub fn main(init: std.process.Init) !void {
const alloc = init.arena.allocator();
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
const http = try chilkat.Http.init();
defer http.deinit();
// Use your Shopify store's Admin API key and password.
http.setLogin("admin3_api_key");
http.setPassword("admin3_password");
http.setBasicAuth(true);
const json_str = http.quickGetStr(alloc, "https://mystore.myshopify.com/admin/api/2020-07/products.json") catch {
std.debug.print("{s}\n", .{try http.getLastErrorText(alloc)});
return;
};
std.debug.print("Response status code: {d}\n", .{http.getLastStatus()});
std.debug.print("JSON response:\n", .{});
std.debug.print("{s}\n", .{json_str});
}