Sample code for 30+ languages & platforms
Go

BrickLink OAuth1 using Chilkat HTTP

See more BrickLink Examples

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

Chilkat Go Downloads

Go
    success := false

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

    http := chilkat.NewHttp()

    http.SetOAuth1(true)
    http.SetOAuthConsumerKey("Your Consumer Key")
    http.SetOAuthConsumerSecret("Your Consumer Secret")
    http.SetOAuthToken("Your OAuth1 Token")
    http.SetOAuthTokenSecret("Your Token Secret")
    http.SetOAuthSigMethod("HMAC-SHA1")

    resp := chilkat.NewHttpResponse()
    success = http.HttpNoBody("GET","https://api.bricklink.com/api/store/v1/orders?direction=in",resp)
    if success == false {
        fmt.Println(http.LastErrorText())
        http.DisposeHttp()
        resp.DisposeHttpResponse()
        return
    }

    fmt.Println("Response status code = ", resp.StatusCode())

    json := chilkat.NewJsonObject()
    resp.GetBodyJson(json)

    json.SetEmitCompact(false)
    fmt.Println(*json.Emit())

    http.DisposeHttp()
    resp.DisposeHttpResponse()
    json.DisposeJsonObject()