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
(AutoIt) Adobe Analytics Reporting API (1.4)Demonstrates a simple POST of JSON to the Adobe Analytics Reporting API (v1.4)
; This requires the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. Local $bSuccess ; In this example, replace "rsid" with your report suite id, and update the URL to use the correct endpoint Local $sUrl = "https://api.omniture.com/admin/1.4/rest/?method=Report.Queue" $oJson = ObjCreate("Chilkat.JsonObject") $oJson.UpdateString("reportDescription.reportSuiteID","rsid") $oJson.UpdateString("reportDescription.dateGranularity","hour") $oHttp = ObjCreate("Chilkat.Http") $oDt = ObjCreate("Chilkat.CkDateTime") $oDt.SetFromCurrentSystemTime() Local $sTimecreated = $oDt.GetAsTimestamp(False) $oPrng = ObjCreate("Chilkat.Prng") Local $sNonce = $oPrng.GenRandom(12,"hex") Local $secret = "SECRET" $oSb = ObjCreate("Chilkat.StringBuilder") $oSb.Append($sNonce) $oSb.Append($sTimecreated) $oSb.Append($secret) $oCrypt = ObjCreate("Chilkat.Crypt2") $oCrypt.HashAlgorithm = "sha1" $oCrypt.EncodingMode = "base64" Local $sDigest = $oCrypt.HashStringENC($oSb.GetAsString()) $oSbNonce = ObjCreate("Chilkat.StringBuilder") $oSbNonce.Append($sNonce) $oSbNonce.Encode("base64") $oSb.Clear $oSb.Append("UsernameToken Username=""USERNAME"", PasswordDigest=""") $oSb.Append($sDigest) $oSb.Append(""", Nonce=""") $oSb.Append($oSbNonce.GetAsString()) $oSb.Append(""", Created=""") $oSb.Append($sTimecreated) $oSb.Append("""") ConsoleWrite($oSb.GetAsString() & @CRLF) $oHttp.SetRequestHeader "X-WSSE",$oSb.GetAsString() Local $oResp = $oHttp.PostJson2($sUrl,"text/json",$oJson.Emit()) If ($oHttp.LastMethodSuccess <> True) Then ConsoleWrite($oHttp.LastErrorText & @CRLF) Exit EndIf ConsoleWrite("Http Status code: " & $oResp.StatusCode & @CRLF) ConsoleWrite("JSON response:" & @CRLF) ConsoleWrite($oResp.BodyStr & @CRLF) |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.