Sample code for 30+ languages & platforms
PowerBuilder

Yousign: Download File

See more Yousign Examples

Downloads a previously uploaded Yousign file.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Http
string ls_DownloadUrl
string ls_LocalFilePath

li_Success = 0

// This example assumes 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

// 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"
ls_LocalFilePath = "qa_output/x.pdf"

li_Success = loo_Http.Download(ls_DownloadUrl,ls_LocalFilePath)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    return
end if

Write-Debug "The PDF file is downloaded..."


destroy loo_Http