Rest
rest.post
Shared
Executes a POST request on specified url
Syntax
local response, error = rest.post(url, body, headers = {
"Content-Type: application/json"
})Requires execution within a valid thread context for asynchronous, non-blocking operation.
Calls made outside a thread will fail to process.
Parameters
| Type | Name | Description |
|---|---|---|
string | url | Request URL to query |
string | body | Request body for query |
table | headers | Request headers for query |
Returns
| Type | Name | Description |
|---|---|---|
string / bool | response | Response on successful execution, or false on failure |
string / bool | error | false on successful execution, or error on failure |
Examples
engine.print("Response:", rest.post("https://api.example.com/users", table.encode({
name: "John Doe",
email: "john@example.com"
}, "JSON")))