Java
Chilkat2 Java
Download a Jira Attachment
See more Jira Examples
Demonstrates how to download a Jira attachment to a file.Chilkat Java Downloads
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.Http;
public class ChilkatExample {
public static void main(String[] args) {
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Http http = new Http();
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}
String url = "https://chilkat.atlassian.net/secure/attachment/10001/starfish.jpg";
String localFilePath = "qa_output/starfish.jpg";
try {
http.download(url, localFilePath);
} catch (ChilkatException e) {
System.out.println(e.getLastErrorText());
return;
}
System.out.println("Successfully downloaded Jira attachment.");
}
}