Sample code for 30+ languages & platforms
Lua

HTTP DELETE with Body

See more HTTP Examples

Demonstrates how to send a DELETE request with a body.

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

-- Use the HttpStr method (or HttpSb) to send a DELETE request with a body.
local requestBody = "{ \"abc\": 123 }"
local resp = chilkat.HttpResponse.new()
local success = http:http_str("DELETE", "https://example.com/something", requestBody, "utf-8", "application/json", resp)
if not success then
    print(http.last_error_text)
    return
end

print("Response status: " .. resp.status_code)
print("Response body: ")
print(resp.body_str)