Sample code for 30+ languages & platforms
Zig

Yousign: Download File to Memory

See more Yousign Examples

Downloads a previously uploaded Yousign file (PDF) to memory.

Chilkat Zig Downloads

Zig
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();

    // Adds the "Authorization: Bearer YOUR_API_KEY" header.
    http.setAuthToken("YOUR_API_KEY");

    const download_url = "https://staging-api.yousign.com/files/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/download?alt=media";

    const pdf_data = try chilkat.BinData.init();
    defer pdf_data.deinit();
    http.downloadBd(download_url, pdf_data) catch {
        std.debug.print("{s}\n", .{try http.getLastErrorText(alloc)});
        return;
    };

    // Your application may now access the data contained in "pdfData".

    std.debug.print("Success\n", .{});
}