(PowerBuilder) Download a Jira Attachment
Demonstrates how to download a Jira attachment to a file.
integer li_rc
oleobject loo_Http
string ls_Url
string ls_LocalFilePath
integer li_Success
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
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
|