Sample code for 30+ languages & platforms
Visual FoxPro

Magento Request with OAuth1.0a Authentication

See more Magento Examples

Demonstrates sending a Magento request with OAuth1.0a authentication. (Using the Magento 1.x REST API)

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loHttp
LOCAL lcUrl
LOCAL lcJsonStr
LOCAL loJson

lnSuccess = 0

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

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)

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