Chilkat HOME Android™ Classic ASP C C++ C# Mono C# .NET Core C# C# UWP/WinRT DataFlex Delphi ActiveX Delphi DLL Visual FoxPro Java Lianja MFC Objective-C Perl PHP ActiveX PHP Extension PowerBuilder PowerShell PureBasic CkPython Chilkat2-Python Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ Visual Basic 6.0 VB.NET VB.NET UWP/WinRT VBScript Xojo Plugin Node.js Excel Go
(Excel) 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. ' In this example, replace "rsid" with your report suite id, and update the URL to use the correct endpoint url = "https://api.omniture.com/admin/1.4/rest/?method=Report.Queue" Dim json As Chilkat.JsonObject Set json = Chilkat.NewJsonObject success = json.UpdateString("reportDescription.reportSuiteID","rsid") success = json.UpdateString("reportDescription.dateGranularity","hour") Dim http As Chilkat.Http Set http = Chilkat.NewHttp Dim dt As Chilkat.CkDateTime Set dt = Chilkat.NewCkDateTime success = dt.SetFromCurrentSystemTime() timecreated = dt.GetAsTimestamp(False) Dim prng As Chilkat.Prng Set prng = Chilkat.NewPrng nonce = prng.GenRandom(12,"hex") secret = "SECRET" Dim sb As Chilkat.StringBuilder Set sb = Chilkat.NewStringBuilder success = sb.Append(nonce) success = sb.Append(timecreated) success = sb.Append(secret) Dim crypt As Chilkat.Crypt2 Set crypt = Chilkat.NewCrypt2 crypt.HashAlgorithm = "sha1" crypt.EncodingMode = "base64" digest = crypt.HashStringENC(sb.GetAsString()) Dim sbNonce As Chilkat.StringBuilder Set sbNonce = Chilkat.NewStringBuilder success = sbNonce.Append(nonce) success = sbNonce.Encode("base64") sb.Clear success = sb.Append("UsernameToken Username=""USERNAME"", PasswordDigest=""") success = sb.Append(digest) success = sb.Append(""", Nonce=""") success = sb.Append(sbNonce.GetAsString()) success = sb.Append(""", Created=""") success = sb.Append(timecreated) success = sb.Append("""") Debug.Print sb.GetAsString() http.SetRequestHeader "X-WSSE",sb.GetAsString() Set resp = http.PostJson2(url,"text/json",json.Emit()) If (http.LastMethodSuccess <> True) Then Debug.Print http.LastErrorText Exit Sub End If Debug.Print "Http Status code: "; resp.StatusCode Debug.Print "JSON response:" Debug.Print resp.BodyStr |
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.