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) REST Auto Reconnect for Multiple Requests (dev.markitondemand.com)Demonstrates how the autoReconnect argument to the Connect method is used.
Use ChilkatAx-win32.pkg Procedure Test Handle hoRest Boolean iBTls Integer iPort Boolean iBAutoReconnect Boolean iSuccess String sResponseXml Handle hoXml String sTemp1 Boolean bTemp1 // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. Get Create (RefClass(cComChilkatRest)) To hoRest If (Not(IsComObjectCreated(hoRest))) Begin Send CreateComObject of hoRest End // This example demonstrates the usage of the autoReconnect argument to the Connect method. // When autoReconnect is on, subsequent REST method calls will automatically re-connect // if necessary, using the same information (domain/IP address, port number, and TLS). Move False To iBTls Move 80 To iPort Move True To iBAutoReconnect Get ComConnect Of hoRest "dev.markitondemand.com" iPort iBTls iBAutoReconnect To iSuccess // Get a stock quote: Get ComAddQueryParam Of hoRest "symbol" "AAPL" To iSuccess Get ComFullRequestNoBody Of hoRest "GET" "/MODApis/Api/v2/Quote" To sResponseXml Get ComLastMethodSuccess Of hoRest To bTemp1 If (bTemp1 <> True) Begin Get ComLastErrorText Of hoRest To sTemp1 Showln sTemp1 Procedure_Return End Get Create (RefClass(cComChilkatXml)) To hoXml If (Not(IsComObjectCreated(hoXml))) Begin Send CreateComObject of hoXml End Get ComLoadXml Of hoXml sResponseXml To iSuccess Get ComGetChildContent Of hoXml "LastPrice" To sTemp1 Showln "AAPL LastPrice: " sTemp1 // Get another stock quote. If a new HTTP connection is required, // the REST object will automatically connect using the same parameters. Get ComAddQueryParam Of hoRest "symbol" "AMZN" To iSuccess Get ComFullRequestNoBody Of hoRest "GET" "/MODApis/Api/v2/Quote" To sResponseXml Get ComLastMethodSuccess Of hoRest To bTemp1 If (bTemp1 <> True) Begin Get ComLastErrorText Of hoRest To sTemp1 Showln sTemp1 Procedure_Return End Get ComLoadXml Of hoXml sResponseXml To iSuccess Get ComGetChildContent Of hoXml "LastPrice" To sTemp1 Showln "AMZN LastPrice: " sTemp1 End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.