Dart
Dart
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 Dart Downloads
import 'package:chilkat/chilkat.dart';
void main() {
final rest = CkRest();
final bTls = true;
final bAutoReconnect = true;
try {
rest.connect('example.com', 443, bTls, bAutoReconnect);
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
// Send a complete request with no request body, such as a GET or DELETE. The response body is read
// as text and returned.
final String responseText;
try {
responseText = rest.fullRequestNoBody('GET', '/api/items/123');
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
print(responseText);
}