Sample code for 30+ languages & platforms
PowerBuilder

Download a Jira Attachment

See more Jira Examples

Demonstrates how to download a Jira attachment to a file.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Http
string ls_Url
string ls_LocalFilePath

li_Success = 0

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

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_Http.FollowRedirects = 1

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

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

ls_Url = "https://chilkat.atlassian.net/secure/attachment/10001/starfish.jpg"
ls_LocalFilePath = "qa_output/starfish.jpg"
li_Success = loo_Http.Download(ls_Url,ls_LocalFilePath)
if li_Success <> 1 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    return
end if

Write-Debug "Successfully downloaded Jira attachment."


destroy loo_Http