Sample code for 30+ languages & platforms
PureBasic

Yousign: Download File

See more Yousign Examples

Downloads a previously uploaded Yousign file.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkHttp.pb"

Procedure ChilkatExample()

    success.i = 0

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

    http.i = CkHttp::ckCreate()
    If http.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    ; Adds the "Authorization: Bearer YOUR_API_KEY" header.
    CkHttp::setCkAuthToken(http, "YOUR_API_KEY")

    downloadUrl.s = "https://staging-api.yousign.com/files/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/download?alt=media"
    localFilePath.s = "qa_output/x.pdf"

    success = CkHttp::ckDownload(http,downloadUrl,localFilePath)
    If success = 0
        Debug CkHttp::ckLastErrorText(http)
        CkHttp::ckDispose(http)
        ProcedureReturn
    EndIf

    Debug "The PDF file is downloaded..."


    CkHttp::ckDispose(http)


    ProcedureReturn
EndProcedure