Sample code for 30+ languages & platforms
Lua 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 Lua Downloads

Lua
local chilkat = require("chilkat")

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

local http = chilkat.Http.new()

http.oauth1 = true
http.oauth_consumer_key = "Your Consumer Key"
http.oauth_consumer_secret = "Your Consumer Secret"
http.oauth_token = "Your OAuth1 Token"
http.oauth_token_secret = "Your Token Secret"
http.oauth_sig_method = "HMAC-SHA1"

local resp = chilkat.HttpResponse.new()
local success = http:http_no_body("GET", "https://api.bricklink.com/api/store/v1/orders?direction=in", resp)
if not success then
    print(http.last_error_text)
    return
end

print("Response status code = " .. resp.status_code)

local json = chilkat.JsonObject.new()
resp:get_body_json(json)

json.emit_compact = false
print(json:emit())