Sample code for 30+ languages & platforms
AutoIt

REST Auto Reconnect for Multiple Requests (dev.markitondemand.com)

See more REST Examples

Demonstrates how the autoReconnect argument to the Connect method is used.

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

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

$oRest = ObjCreate("Chilkat.Rest")

; 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).
Local $bTls = False
Local $iPort = 80
Local $bAutoReconnect = True
$bSuccess = $oRest.Connect("dev.markitondemand.com",$iPort,$bTls,$bAutoReconnect)

; Get a stock quote:
$bSuccess = $oRest.AddQueryParam("symbol","AAPL")
Local $sResponseXml = $oRest.FullRequestNoBody("GET","/MODApis/Api/v2/Quote")
If ($oRest.LastMethodSuccess <> True) Then
    ConsoleWrite($oRest.LastErrorText & @CRLF)
    Exit
EndIf

$oXml = ObjCreate("Chilkat.Xml")
$bSuccess = $oXml.LoadXml($sResponseXml)
ConsoleWrite("AAPL LastPrice: " & $oXml.GetChildContent("LastPrice") & @CRLF)

; Get another stock quote.  If a new HTTP connection is required,
; the REST object will automatically connect using the same parameters.
$bSuccess = $oRest.AddQueryParam("symbol","AMZN")
$sResponseXml = $oRest.FullRequestNoBody("GET","/MODApis/Api/v2/Quote")
If ($oRest.LastMethodSuccess <> True) Then
    ConsoleWrite($oRest.LastErrorText & @CRLF)
    Exit
EndIf

$bSuccess = $oXml.LoadXml($sResponseXml)
ConsoleWrite("AMZN LastPrice: " & $oXml.GetChildContent("LastPrice") & @CRLF)