Zig
Zig
Download a Jira Attachment
See more Jira Examples
Demonstrates how to download a Jira attachment to a file.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();
http.setFollowRedirects(true);
// Provide the username/password for authentication
http.setLogin("jira@example.com");
http.setPassword("JIRA_API_TOKEN");
// The URL for a Jira attachment has this format:
// https://your-domain.atlassian.net/secure/attachment/{attachment_id}/{attachment_filename}
const url = "https://chilkat.atlassian.net/secure/attachment/10001/starfish.jpg";
const local_file_path = "qa_output/starfish.jpg";
http.download(url, local_file_path) catch {
std.debug.print("{s}\n", .{try http.getLastErrorText(alloc)});
return;
};
std.debug.print("Successfully downloaded Jira attachment.\n", .{});
}