(AutoIt) BrickLink OAuth1 using Chilkat REST
Demonstrates sending an api.bricklink.com request with OAuth1 authentication using Chilkat REST.
Note: This example requires Chilkat v9.5.0.91 or greater (due to adjustments made within Chilkat to support bricklink OAuth1 needs). For more information, see https://www.bricklink.com/v3/api.page?page=auth
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oOauth1 = ObjCreate("Chilkat.OAuth1")
$oOauth1.ConsumerKey = "Your Consumer Key"
$oOauth1.ConsumerSecret = "Your Consumer Secret"
$oOauth1.Token = "Your OAuth1 Token"
$oOauth1.TokenSecret = "Your Token Secret"
$oOauth1.SignatureMethod = "HMAC-SHA1"
Local $bSuccess
$oRest = ObjCreate("Chilkat.Rest")
$oRest.SetAuthOAuth1($oOauth1,False)
$bSuccess = $oRest.Connect("api.bricklink.com",443,True,True)
If ($bSuccess = False) Then
ConsoleWrite($oRest.LastErrorText & @CRLF)
Exit
EndIf
$oSbResponse = ObjCreate("Chilkat.StringBuilder")
$bSuccess = $oRest.FullRequestNoBodySb("GET","/api/store/v1/orders?direction=in",$oSbResponse)
If ($bSuccess = False) Then
ConsoleWrite($oRest.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite("Response status code = " & $oRest.ResponseStatusCode & @CRLF)
$oJson = ObjCreate("Chilkat.JsonObject")
$oJson.LoadSb($oSbResponse)
$oJson.EmitCompact = False
ConsoleWrite($oJson.Emit() & @CRLF)
|