Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(DataFlex) Adobe Analytics Reporting API (1.4)Demonstrates a simple POST of JSON to the Adobe Analytics Reporting API (v1.4)
Use ChilkatAx-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-2024 Chilkat Software, Inc. All Rights Reserved.