Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

DataFlex Examples

Web API Categories

ASN.1
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
Geolocation
Google APIs
Google Calendar
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text

HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
REST
REST Misc
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Socket/SSL/TLS
Spider
Stream
Tar Archive
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl

 

 

 

(DataFlex) Adobe Analytics Reporting API (1.4)

Demonstrates a simple POST of JSON to the Adobe Analytics Reporting API (v1.4)

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Boolean iSuccess
    String sUrl
    Handle hoJson
    Handle hoHttp
    Handle hoDt
    String sTimecreated
    Handle hoPrng
    String sNonce
    String sSecret
    Handle hoSb
    Handle hoCrypt
    String sDigest
    Handle hoSbNonce
    Variant vResp
    Handle hoResp
    String sTemp1
    Integer iTemp1
    Boolean bTemp1

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

    //  In this example, replace "rsid" with your report suite id, and update the URL to use the correct endpoint
    Move "https://api.omniture.com/admin/1.4/rest/?method=Report.Queue" To sUrl

    Get Create (RefClass(cComChilkatJsonObject)) To hoJson
    If (Not(IsComObjectCreated(hoJson))) Begin
        Send CreateComObject of hoJson
    End
    Get ComUpdateString Of hoJson "reportDescription.reportSuiteID" "rsid" To iSuccess
    Get ComUpdateString Of hoJson "reportDescription.dateGranularity" "hour" To iSuccess

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

    Get Create (RefClass(cComCkDateTime)) To hoDt
    If (Not(IsComObjectCreated(hoDt))) Begin
        Send CreateComObject of hoDt
    End
    Get ComSetFromCurrentSystemTime Of hoDt To iSuccess
    Get ComGetAsTimestamp Of hoDt False To sTimecreated

    Get Create (RefClass(cComChilkatPrng)) To hoPrng
    If (Not(IsComObjectCreated(hoPrng))) Begin
        Send CreateComObject of hoPrng
    End
    Get ComGenRandom Of hoPrng 12 "hex" To sNonce

    Move "SECRET" To sSecret

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSb
    If (Not(IsComObjectCreated(hoSb))) Begin
        Send CreateComObject of hoSb
    End
    Get ComAppend Of hoSb sNonce To iSuccess
    Get ComAppend Of hoSb sTimecreated To iSuccess
    Get ComAppend Of hoSb sSecret To iSuccess

    Get Create (RefClass(cComChilkatCrypt2)) To hoCrypt
    If (Not(IsComObjectCreated(hoCrypt))) Begin
        Send CreateComObject of hoCrypt
    End
    Set ComHashAlgorithm Of hoCrypt To "sha1"
    Set ComEncodingMode Of hoCrypt To "base64"
    Get ComGetAsString Of hoSb To sTemp1
    Get ComHashStringENC Of hoCrypt sTemp1 To sDigest

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbNonce
    If (Not(IsComObjectCreated(hoSbNonce))) Begin
        Send CreateComObject of hoSbNonce
    End
    Get ComAppend Of hoSbNonce sNonce To iSuccess
    Get ComEncode Of hoSbNonce "base64" To iSuccess

    Send ComClear To hoSb
    Get ComAppend Of hoSb 'UsernameToken Username="USERNAME", PasswordDigest="' To iSuccess
    Get ComAppend Of hoSb sDigest To iSuccess
    Get ComAppend Of hoSb '", Nonce="' To iSuccess
    Get ComGetAsString Of hoSbNonce To sTemp1
    Get ComAppend Of hoSb sTemp1 To iSuccess
    Get ComAppend Of hoSb '", Created="' To iSuccess
    Get ComAppend Of hoSb sTimecreated To iSuccess
    Get ComAppend Of hoSb '"' To iSuccess

    Get ComGetAsString Of hoSb To sTemp1
    Showln sTemp1

    Get ComGetAsString Of hoSb To sTemp1
    Send ComSetRequestHeader To hoHttp "X-WSSE" sTemp1

    Get ComEmit Of hoJson To sTemp1
    Get ComPostJson2 Of hoHttp sUrl "text/json" sTemp1 To vResp
    If (IsComObject(vResp)) Begin
        Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
        Set pvComObject Of hoResp To vResp
    End
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 <> True) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComStatusCode Of hoResp To iTemp1
    Showln "Http Status code: " iTemp1
    Showln "JSON response:"
    Get ComBodyStr Of hoResp To sTemp1
    Showln sTemp1

    Send Destroy of hoResp


End_Procedure

 

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