Sample code for 30+ languages & platforms
Perl

Send a REST Request with No Body

See more REST Examples

Demonstrates Rest.FullRequestNoBody, which sends a complete request with no request body (such as a GET or DELETE) and returns the response body as text.

Background. This is the simplest full-request convenience method, ideal for retrieval and deletion calls that carry no request payload.

Chilkat Perl Downloads

Chilkat2 Perl
use strict;
use warnings;
use Chilkat2;

my $rest = Chilkat2::Rest->new;
my $bTls = 1;
my $bAutoReconnect = 1;
my $success = $rest->Connect('example.com', 443, $bTls, $bAutoReconnect);
if (!$success) {
    print $rest->LastErrorText, "\n";
    exit;
}

# Send a complete request with no request body, such as a GET or DELETE.  The response body is read
# as text and returned.
my $responseText = $rest->FullRequestNoBody('GET', '/api/items/123');
if (!$rest->LastMethodSuccess) {
    print $rest->LastErrorText, "\n";
    exit;
}

print $responseText, "\n";