Sample code for 30+ languages & platforms
Xbase++ Requires Chilkat v11.0.0+

BrickLink OAuth1 using Chilkat HTTP

See more BrickLink Examples

Demonstrates sending an api.bricklink.com request with OAuth1 authentication using Chilkat HTTP.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oHttp
LOCAL oResp
LOCAL oJson

nSuccess := 0

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

oHttp := CreateObject("Chilkat.Http")

oHttp:OAuth1 := 1
oHttp:OAuthConsumerKey := "Your Consumer Key"
oHttp:OAuthConsumerSecret := "Your Consumer Secret"
oHttp:OAuthToken := "Your OAuth1 Token"
oHttp:OAuthTokenSecret := "Your Token Secret"
oHttp:OAuthSigMethod := "HMAC-SHA1"

oResp := CreateObject("Chilkat.HttpResponse")
nSuccess := oHttp:HttpNoBody("GET", "https://api.bricklink.com/api/store/v1/orders?direction=in", oResp)
IF (nSuccess == 0)
    ? oHttp:LastErrorText
    oHttp:destroy()
    oResp:destroy()
    RETURN
ENDIF

? "Response status code = " + Str(oResp:StatusCode)

oJson := CreateObject("Chilkat.JsonObject")
oResp:GetBodyJson(oJson)

oJson:EmitCompact := 0
? oJson:Emit()

oHttp:destroy()
oResp:destroy()
oJson:destroy()