Sample code for 30+ languages & platforms
Lua

Aruba Fatturazione Elettronica GetTransmissionInfoRequest

See more Aruba Fatturazione Examples

Query the status of a request.

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()

-- Implements the following CURL command:

-- curl -X POST https://ws.fatturazioneelettronica.aruba.it/services/ClientRequest/GetTransmissionInfoRequest \
--   -H "Accept: application/json" \
--   -H "Content-Type: application/json;charset=UTF-8" \
--   -d '{
--   "userName" : "ARUBA0000",
--   "password" : "ArubaPwd",
--   "requestID" : "UYZCDNDYKQ"
-- }'

-- Use the following online tool to generate HTTP code from a CURL command
-- Convert a cURL Command to HTTP Source Code

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

-- The following JSON is sent in the request body.

-- {
--   "userName": "ARUBA0000",
--   "password": "ArubaPwd",
--   "requestID": "UYZCDNDYKQ"
-- }

local json = chilkat.JsonObject.new()
json:update_string("userName", "ARUBA0000")
json:update_string("password", "ArubaPwd")
json:update_string("requestID", "UYZCDNDYKQ")

http:set_request_header("Content-Type", "application/json;charset=UTF-8")
http:set_request_header("Accept", "application/json")

local resp = chilkat.HttpResponse.new()
local success = http:http_json("POST", "https://ws.fatturazioneelettronica.aruba.it/services/ClientRequest/GetTransmissionInfoRequest", json, "application/json", resp)
if not success then
    print(http.last_error_text)
    return
end

local sbResponseBody = chilkat.StringBuilder.new()
resp:get_body_sb(sbResponseBody)

local jResp = chilkat.JsonObject.new()
jResp:load_sb(sbResponseBody)
jResp.emit_compact = false

print("Response Body:")
print(jResp:emit())

local respStatusCode = resp.status_code
print("Response Status Code = " .. respStatusCode)
if respStatusCode >= 400 then
    print("Response Header:")
    print(resp.header)
    print("Failed.")
else
    print("Success.")
end