Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

DataFlex Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(DataFlex) DocuSign Download Envelope Document (PDF)

See more DocuSign Examples

Retrieves the specified document from the envelope. The response body of this method is the PDF file as a byte stream. You can get the file name and document ID from the response's Content-Disposition header.

For more information, see https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopedocuments/get/

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Handle hoJsonToken
    String sUrl
    Variant vBd
    Handle hoBd
    Integer iRespStatusCode
    Handle hoMime
    String sFilename
    Handle hoSbPath
    String sTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    // Implements the following HTTP request:
    // GET /restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents/1

    // Adds the "Authorization: Bearer eyJ0eXAi.....UE8Kl_V8KroQ" header.
    Get Create (RefClass(cComChilkatJsonObject)) To hoJsonToken
    If (Not(IsComObjectCreated(hoJsonToken))) Begin
        Send CreateComObject of hoJsonToken
    End
    // Load a previously obtained OAuth2 access token.
    Get ComLoadFile Of hoJsonToken "qa_data/tokens/docusign.json" To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoJsonToken To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComStringOf Of hoJsonToken "access_token" To sTemp1
    Set ComAuthToken Of hoHttp To sTemp1

    // Use your account ID and a valid envelopeId here:
    Get ComSetUrlVar Of hoHttp "accountId" "7f3f65ed-5e87-418d-94c1-92499ddc8252" To iSuccess
    Get ComSetUrlVar Of hoHttp "envelopeId" "90d7e40a-b4bd-4ccd-bf38-c80e37954a13" To iSuccess

    Move "https://demo.docusign.net/restapi/v2.1/accounts/{$accountId}/envelopes/{$envelopeId}/documents/1" To sUrl
    Get Create (RefClass(cComChilkatBinData)) To hoBd
    If (Not(IsComObjectCreated(hoBd))) Begin
        Send CreateComObject of hoBd
    End

    Get pvComObject of hoBd to vBd
    Get ComDownloadBd Of hoHttp sUrl vBd To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComLastStatus Of hoHttp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode <> 200) Begin
        Showln "Response Header:"
        Get ComLastResponseHeader Of hoHttp To sTemp1
        Showln sTemp1
        // The response body contains an error message.
        Get ComGetString Of hoBd "utf-8" To sTemp1
        Showln sTemp1
        Showln "Failed."
        Procedure_Return
    End

    // The response indicated success.
    // Get the filename from the Content-Disposition header and save to a file.
    Get Create (RefClass(cComChilkatMime)) To hoMime
    If (Not(IsComObjectCreated(hoMime))) Begin
        Send CreateComObject of hoMime
    End
    Get ComLastResponseHeader Of hoHttp To sTemp1
    Get ComLoadMime Of hoMime sTemp1 To iSuccess

    Get ComGetHeaderFieldAttribute Of hoMime "Content-Disposition" "filename" To sFilename
    Showln "filename = " sFilename

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbPath
    If (Not(IsComObjectCreated(hoSbPath))) Begin
        Send CreateComObject of hoSbPath
    End
    Get ComAppend Of hoSbPath "C:/aaworkarea/" To iSuccess
    Get ComAppend Of hoSbPath sFilename To iSuccess
    Get ComGetAsString Of hoSbPath To sTemp1
    Get ComWriteFile Of hoBd sTemp1 To iSuccess
    If (iSuccess = False) Begin
        Showln "Failed to save to output file."
    End
    Else Begin
        Get ComGetAsString Of hoSbPath To sTemp1
        Showln "Wrote " sTemp1
    End



End_Procedure

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.