(Go) BrickLink OAuth1 using Chilkat HTTP
Demonstrates sending an api.bricklink.com request with OAuth1 authentication using Chilkat HTTP.Note: This example requires Chilkat v11.0.0 or greater. For more information, see https://www.bricklink.com/v3/api.page?page=auth
success := false
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http := Http_Ref.html">chilkat.NewHttp()
http.SetOAuth1(true)
http.SetOAuthConsumerKey("Your Consumer Key")
http.SetOAuthConsumerSecret("Your Consumer Secret")
http.SetOAuthToken("Your OAuth1_Ref.html">OAuth1 Token")
http.SetOAuthTokenSecret("Your Token Secret")
http.SetOAuthSigMethod("HMAC-SHA1")
resp := HttpResponse_Ref.html">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 := JsonObject_Ref.html">chilkat.NewJsonObject()
resp.GetBodyJson(json)
json.SetEmitCompact(false)
fmt.Println(*json.Emit())
http.DisposeHttp()
resp.DisposeHttpResponse()
json.DisposeJsonObject()
|