Sample code for 30+ languages & platforms
Xbase++

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 Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oHttp
LOCAL cUrl
LOCAL cJsonStr
LOCAL oJson

nSuccess := 0

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

oHttp := CreateObject("Chilkat.Http")

oHttp:OAuth1 := 1
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"

cUrl := "http://www.inart.com/api/rest/products/store/2?limit=20&page=1"

cJsonStr := oHttp:QuickGetStr(cUrl)
IF (oHttp:LastMethodSuccess != 1)
    ? oHttp:LastErrorText
    oHttp:destroy()
    RETURN
ENDIF

? "Response status code = " + Str(oHttp:LastStatus)

oJson := CreateObject("Chilkat.JsonObject")
oJson:Load(cJsonStr)
oJson:EmitCompact := 0

? oJson:Emit()

//  Use this online tool to generate parsing code from sample JSON: 
//  Generate Parsing Code from JSON

oHttp:destroy()
oJson:destroy()