Sample code for 30+ languages & platforms
Lua

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

Lua
local chilkat = require("chilkat")

local success = false

-- This example requires 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_verifier = ""
http.oauth_consumer_key = "MAGENTO_CONSUMER_KEY"
http.oauth_consumer_secret = "MAGENTO_CONSUMER_SECRET"
http.oauth_token = "MAGENTO__TOKEN"
http.oauth_token_secret = "MAGENTO_TOKEN_SECRET"

http.accept = "application/json"

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

local jsonStr = http:quick_get_str(url)
if not http.last_method_success then
    print(http.last_error_text)
    return
end

print("Response status code = " .. http.last_status)

local json = chilkat.JsonObject.new()
json:load(jsonStr)
json.emit_compact = false

print(json:emit())

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