Perl
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
use chilkat();
$success = 0;
$rest = chilkat::CkRest->new();
$bTls = 1;
$bAutoReconnect = 1;
$success = $rest->Connect("example.com",443,$bTls,$bAutoReconnect);
if ($success == 0) {
print $rest->lastErrorText() . "\r\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.
$responseText = $rest->fullRequestNoBody("GET","/api/items/123");
if ($rest->get_LastMethodSuccess() == 0) {
print $rest->lastErrorText() . "\r\n";
exit;
}
print $responseText . "\r\n";