(AutoIt) Magento Request with OAuth1.0a Authentication
Demonstrates sending a Magento request with OAuth1.0a authentication. (Using the Magento 1.x REST API)
; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
Local $bSuccess
$oHttp = ObjCreate("Chilkat.Http")
$oHttp.OAuth1 = True
$oHttp.OAuthVerifier = ""
$oHttp.OAuthConsumerKey = "MAGENTO_CONSUMER_KEY"
$oHttp.OAuthConsumerSecret = "MAGENTO_CONSUMER_SECRET"
$oHttp.OAuthToken = "MAGENTO__TOKEN"
$oHttp.OAuthTokenSecret = "MAGENTO_TOKEN_SECRET"
$oHttp.Accept = "application/json"
Local $sUrl = "http://www.inart.com/api/rest/products/store/2?limit=20&page=1"
Local $sJsonStr = $oHttp.QuickGetStr($sUrl)
If ($oHttp.LastMethodSuccess <> True) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite("Response status code = " & $oHttp.LastStatus & @CRLF)
$oJson = ObjCreate("Chilkat.JsonObject")
$oJson.Load($sJsonStr)
$oJson.EmitCompact = False
ConsoleWrite($oJson.Emit() & @CRLF)
; Use this online tool to generate parsing code from sample JSON:
; Generate Parsing Code from JSON
|