Sample code for 30+ languages & platforms
Perl

HTTP DELETE with Body

See more HTTP Examples

Demonstrates how to send a DELETE request with a body.

Chilkat Perl Downloads

Perl
use strict;
use warnings;
use Chilkat2;

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

my $http = Chilkat2::Http->new;

# Use the HttpStr method (or HttpSb) to send a DELETE request with a body.
my $requestBody = '{ "abc": 123 }';
my $resp = Chilkat2::HttpResponse->new;
my $success = $http->HttpStr('DELETE', 'https://example.com/something', $requestBody, 'utf-8', 'application/json', $resp);
if (!$success) {
    print $http->LastErrorText, "\n";
    exit;
}

print 'Response status: ', $resp->StatusCode, "\n";
print "Response body: \n";
print $resp->BodyStr, "\n";