Sample code for 30+ languages & platforms
Xbase++

Download a Jira Attachment

See more Jira Examples

Demonstrates how to download a Jira attachment to a file.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oHttp
LOCAL cUrl
LOCAL cLocalFilePath

nSuccess := 0

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

oHttp := CreateObject("Chilkat.Http")

oHttp:FollowRedirects := 1

//  Provide the username/password for authentication
oHttp:Login := "jira@example.com"
oHttp:Password := "JIRA_API_TOKEN"

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

cUrl := "https://chilkat.atlassian.net/secure/attachment/10001/starfish.jpg"
cLocalFilePath := "qa_output/starfish.jpg"
nSuccess := oHttp:Download(cUrl, cLocalFilePath)
IF (nSuccess != 1)
    ? oHttp:LastErrorText
    oHttp:destroy()
    RETURN
ENDIF

? "Successfully downloaded Jira attachment."

oHttp:destroy()