Sample code for 30+ languages & platforms
Lianja

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 Lianja Downloads

Lianja
llSuccess = .F.

// 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