Sample code for 30+ languages & platforms
Delphi DLL

Download a Jira Attachment

See more Jira Examples

Demonstrates how to download a Jira attachment to a file.

Chilkat Delphi DLL Downloads

Delphi DLL
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Http;

...

procedure TForm1.Button1Click(Sender: TObject);
var
success: Boolean;
http: HCkHttp;
url: PWideChar;
localFilePath: PWideChar;

begin
success := False;

// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

http := CkHttp_Create();

CkHttp_putFollowRedirects(http,True);

// Provide the username/password for authentication
CkHttp_putLogin(http,'jira@example.com');
CkHttp_putPassword(http,'JIRA_API_TOKEN');

// The URL for a Jira attachment has this format: 
// https://your-domain.atlassian.net/secure/attachment/{attachment_id}/{attachment_filename}

url := 'https://chilkat.atlassian.net/secure/attachment/10001/starfish.jpg';
localFilePath := 'qa_output/starfish.jpg';
success := CkHttp_Download(http,url,localFilePath);
if (success <> True) then
  begin
    Memo1.Lines.Add(CkHttp__lastErrorText(http));
    Exit;
  end;

Memo1.Lines.Add('Successfully downloaded Jira attachment.');

CkHttp_Dispose(http);

end;