(Lianja) 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.
loHttp = createobject("CkHttp")
loHttp.OAuth1 = .T.
loHttp.OAuthVerifier = ""
loHttp.OAuthConsumerKey = "MAGENTO_CONSUMER_KEY"
loHttp.OAuthConsumerSecret = "MAGENTO_CONSUMER_SECRET"
loHttp.OAuthToken = "MAGENTO__TOKEN"
loHttp.OAuthTokenSecret = "MAGENTO_TOKEN_SECRET"
loHttp.Accept = "application/json"
lcUrl = "http://www.inart.com/api/rest/products/store/2?limit=20&page=1"
lcJsonStr = loHttp.QuickGetStr(lcUrl)
if (loHttp.LastMethodSuccess <> .T.) then
? loHttp.LastErrorText
release loHttp
return
endif
? "Response status code = " + str(loHttp.LastStatus)
loJson = createobject("CkJsonObject")
loJson.Load(lcJsonStr)
loJson.EmitCompact = .F.
? loJson.Emit()
// Use this online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
release loHttp
release loJson
|