Zig
Zig
Duo Auth API - Ping
See more Duo Auth MFA Examples
The /ping endpoint acts as a "liveness check" that can be called to verify that Duo is up before trying to call other Auth API endpoints.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.setAccept("application/json");
// Use your own hostname here:
const url = "https://api-a03782e1.duosecurity.com/auth/v2/ping";
const json_str = http.quickGetStr(alloc, url) catch {
std.debug.print("{s}\n", .{try http.getLastErrorText(alloc)});
return;
};
std.debug.print("status code = {d}\n", .{http.getLastStatus()});
std.debug.print("{s}\n", .{json_str});
// Sample successful output:
// status code = 200
// {"response": {"time": 1632358295}, "stat": "OK"}
}