Corona SDK : Requests
cloud:request
Signature
cloud:request(api_uri[, args_tbl[, listener], headers]]])
Parameters
Name | Description | Type | Default | Required |
---|---|---|---|---|
uri |
The Routing Method uri. Example: /echo/test |
string | nil |
Y |
args_tbl |
A table of name=value pairs. |
table | nil |
N |
listener |
The Corona network.request listener |
function | nil |
N |
headers |
A table of any addtional headers. | table | nil |
N |
Returns
A network event object id.
Example
-- CoronaSDK/main.lua require('coronium.cloud'):new({ host = "123.123.123.123", project_key = "00000000-0000-0000-000000000" }) local function listener(event) if event.phase == "ended" then print( event.response.hello ) -- Outputs "Lua" end end local req = cloud:request('/echo/test', {hello="Lua"}, listener)