Sample code for 30+ languages & platforms
Ruby

HTTP DELETE with Body

See more HTTP Examples

Demonstrates how to send a DELETE request with a body.

Chilkat Ruby Downloads

Ruby
require 'chilkat'

success = false

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

http = Chilkat::CkHttp.new()

# Use the HttpStr method (or HttpSb) to send a DELETE request with a body.
requestBody = "{ \"abc\": 123 }"
resp = Chilkat::CkHttpResponse.new()
success = http.HttpStr("DELETE","https://example.com/something",requestBody,"utf-8","application/json",resp)
if (success == false)
    print http.lastErrorText() + "\n";
    exit
end

print "Response status: " + resp.get_StatusCode().to_s() + "\n";
print "Response body: " + "\n";
print resp.bodyStr() + "\n";