Zig
Zig
ISBNdb API v2 Get Book Details
See more HTTP Misc Examples
Demonstrates how to send a GET request to the ISBNdb API v2 with Authorization header.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 assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
const http = try chilkat.Http.init();
defer http.deinit();
http.setRequestHeader("Authorization", "YOUR_REST_KEY");
const json_str = http.quickGetStr(alloc, "https://api2.isbndb.com/book/9780134093413") catch {
std.debug.print("{s}\n", .{try http.getLastErrorText(alloc)});
return;
};
std.debug.print("Response status code: {d}\n", .{http.getLastStatus()});
std.debug.print("Response JSON:\n", .{});
std.debug.print("{s}\n", .{json_str});
}