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: Return Brand Data Associated with a User

Demonstrates a call using an OAuth2 access token in combination with the account ID for which we have authorization.

For more information, see https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-jsonwebtoken

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
Token    Handle hoJsonToken
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJson
    Integer iRespStatusCode
    String sBrandCompany
    String sBrandId
    String sBrandName
    String sErrorDetailsErrorCode
    String sErrorDetailsMessage
    String sIsOverridingCompanyName
    String sIsSendingDefault
    String sIsSigningDefault
    String sLogosPrimary
    String sLogosSecondary
    String sLogosEmail
    String sResourcesEmail
    String sResourcesSending
    String sResourcesSigning
    String sResourcesSigningCaptive
    Integer j
    Integer iCount_j
    String sLinkType
    String sUrlOrMailTo
    String sLinkText
    String sShowLink
    String sEmailContentType
    String sContent
    String sEmailToLink
    String sRecipientBrandIdDefault
    String sSenderBrandIdDefault
    Integer i
    Integer iCount_i
    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 CURL command:

    // curl --request GET https://account-d.docusign.com/restapi/v2/accounts/18b4799a-xxxx-xxxx-xxxx-b5b4b8a97604/brands --header "Authorization: Bearer eyJ0eXAi.....UE8Kl_V8KroQ"

    // Use the following online tool to generate HTTP code from a CURL command
    // Convert a cURL Command to HTTP Source Code

    // 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 an account ID obtained from DocuSign Get User Account Data
    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComQuickGetSb Of hoHttp "https://account-d.docusign.com/restapi/v2/accounts/18b4799a-xxxx-xxxx-xxxx-b5b4b8a97604/brands" vSbResponseBody To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoJson
    If (Not(IsComObjectCreated(hoJson))) Begin
        Send CreateComObject of hoJson
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJson vSbResponseBody To iSuccess
    Set ComEmitCompact Of hoJson To False

    Showln "Response Body:"
    Get ComEmit Of hoJson To sTemp1
    Showln sTemp1

    Get ComLastStatus Of hoHttp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComLastHeader Of hoHttp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Procedure_Return
    End

    // Sample JSON response:
    // (Sample code for parsing the JSON response is shown below)

    // {
    //   "recipientBrandIdDefault": "sample string 1",
    //   "senderBrandIdDefault": "sample string 2",
    //   "brands": [
    //     {
    //       "brandCompany": "sample string 1",
    //       "brandId": "sample string 2",
    //       "brandName": "sample string 3",
    //       "colors": [
    //         {}
    //       ],
    //       "errorDetails": {
    //         "errorCode": "sample string 1",
    //         "message": "sample string 2"
    //       },
    //       "isOverridingCompanyName": "sample string 4",
    //       "isSendingDefault": "sample string 5",
    //       "isSigningDefault": "sample string 6",
    //       "landingPages": [
    //         {}
    //       ],
    //       "links": [
    //         {
    //           "linkType": "sample string 1",
    //           "urlOrMailTo": "sample string 2",
    //           "linkText": "sample string 3",
    //           "showLink": "sample string 4"
    //         }
    //       ],
    //       "emailContent": [
    //         {
    //           "emailContentType": "sample string 1",
    //           "content": "sample string 2",
    //           "emailToLink": "sample string 3",
    //           "linkText": "sample string 4"
    //         }
    //       ],
    //       "logos": {
    //         "primary": "sample string 1",
    //         "secondary": "sample string 2",
    //         "email": "sample string 3"
    //       },
    //       "resources": {
    //         "email": "sample string 1",
    //         "sending": "sample string 2",
    //         "signing": "sample string 3",
    //         "signingCaptive": "sample string 4"
    //       }
    //     }
    //   ]
    // }

    // Sample code for parsing the JSON response...
    // Use the following online tool to generate parsing code from sample JSON:
    // Generate Parsing Code from JSON

    Get ComStringOf Of hoJson "recipientBrandIdDefault" To sRecipientBrandIdDefault
    Get ComStringOf Of hoJson "senderBrandIdDefault" To sSenderBrandIdDefault
    Move 0 To i
    Get ComSizeOfArray Of hoJson "brands" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "brands[i].brandCompany" To sBrandCompany
        Get ComStringOf Of hoJson "brands[i].brandId" To sBrandId
        Get ComStringOf Of hoJson "brands[i].brandName" To sBrandName
        Get ComStringOf Of hoJson "brands[i].errorDetails.errorCode" To sErrorDetailsErrorCode
        Get ComStringOf Of hoJson "brands[i].errorDetails.message" To sErrorDetailsMessage
        Get ComStringOf Of hoJson "brands[i].isOverridingCompanyName" To sIsOverridingCompanyName
        Get ComStringOf Of hoJson "brands[i].isSendingDefault" To sIsSendingDefault
        Get ComStringOf Of hoJson "brands[i].isSigningDefault" To sIsSigningDefault
        Get ComStringOf Of hoJson "brands[i].logos.primary" To sLogosPrimary
        Get ComStringOf Of hoJson "brands[i].logos.secondary" To sLogosSecondary
        Get ComStringOf Of hoJson "brands[i].logos.email" To sLogosEmail
        Get ComStringOf Of hoJson "brands[i].resources.email" To sResourcesEmail
        Get ComStringOf Of hoJson "brands[i].resources.sending" To sResourcesSending
        Get ComStringOf Of hoJson "brands[i].resources.signing" To sResourcesSigning
        Get ComStringOf Of hoJson "brands[i].resources.signingCaptive" To sResourcesSigningCaptive
        Move 0 To j
        Get ComSizeOfArray Of hoJson "brands[i].colors" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJson To j
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJson "brands[i].landingPages" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJson To j
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJson "brands[i].links" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJson To j
            Get ComStringOf Of hoJson "brands[i].links[j].linkType" To sLinkType
            Get ComStringOf Of hoJson "brands[i].links[j].urlOrMailTo" To sUrlOrMailTo
            Get ComStringOf Of hoJson "brands[i].links[j].linkText" To sLinkText
            Get ComStringOf Of hoJson "brands[i].links[j].showLink" To sShowLink
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJson "brands[i].emailContent" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJson To j
            Get ComStringOf Of hoJson "brands[i].emailContent[j].emailContentType" To sEmailContentType
            Get ComStringOf Of hoJson "brands[i].emailContent[j].content" To sContent
            Get ComStringOf Of hoJson "brands[i].emailContent[j].emailToLink" To sEmailToLink
            Get ComStringOf Of hoJson "brands[i].emailContent[j].linkText" To sLinkText
            Move (j + 1) To j
        Loop

        Move (i + 1) To i
    Loop



End_Procedure

 

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