Sample code for 30+ languages & platforms
PowerBuilder

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

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Http
string ls_Url
string ls_JsonStr
oleobject loo_Json

li_Success = 0

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

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_Http.OAuth1 = 1
loo_Http.OAuthVerifier = ""
loo_Http.OAuthConsumerKey = "MAGENTO_CONSUMER_KEY"
loo_Http.OAuthConsumerSecret = "MAGENTO_CONSUMER_SECRET"
loo_Http.OAuthToken = "MAGENTO__TOKEN"
loo_Http.OAuthTokenSecret = "MAGENTO_TOKEN_SECRET"

loo_Http.Accept = "application/json"

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

ls_JsonStr = loo_Http.QuickGetStr(ls_Url)
if loo_Http.LastMethodSuccess <> 1 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    return
end if

Write-Debug "Response status code = " + string(loo_Http.LastStatus)

loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")

loo_Json.Load(ls_JsonStr)
loo_Json.EmitCompact = 0

Write-Debug loo_Json.Emit()

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


destroy loo_Http
destroy loo_Json