(PowerBuilder) Yousign: Download File to Memory
Downloads a previously uploaded Yousign file (PDF) to memory. For more information, see https://dev.yousign.com/?version=latest#490b263d-a038-4871-acab-5ab73481fb2d
integer li_rc
oleobject loo_Http
integer li_Success
string ls_DownloadUrl
oleobject loo_PdfData
// This example assumes 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
// Adds the "Authorization: Bearer YOUR_API_KEY" header.
loo_Http.AuthToken = "YOUR_API_KEY"
ls_DownloadUrl = "https://staging-api.yousign.com/files/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/download?alt=media"
loo_PdfData = create oleobject
// Use "Chilkat_9_5_0.BinData" for versions of Chilkat < 10.0.0
li_rc = loo_PdfData.ConnectToNewObject("Chilkat.BinData")
li_Success = loo_Http.DownloadBd(ls_DownloadUrl,loo_PdfData)
if li_Success = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_PdfData
return
end if
// Your application may now access the data contained in "pdfData".
Write-Debug "Success"
destroy loo_Http
destroy loo_PdfData
|