(Visual FoxPro) Magento Request with OAuth1.0a Authentication
Demonstrates sending a Magento request with OAuth1.0a authentication. (Using the Magento 1.x REST API)
LOCAL lnSuccess
LOCAL loHttp
LOCAL lcUrl
LOCAL lcJsonStr
LOCAL loJson
* This example requires the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')
loHttp.OAuth1 = 1
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 <> 1) THEN
? loHttp.LastErrorText
RELEASE loHttp
CANCEL
ENDIF
? "Response status code = " + STR(loHttp.LastStatus)
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJson = CreateObject('Chilkat.JsonObject')
loJson.Load(lcJsonStr)
loJson.EmitCompact = 0
? loJson.Emit()
* Use this online tool to generate parsing code from sample JSON:
* Generate Parsing Code from JSON
RELEASE loHttp
RELEASE loJson
|