Objective-C
Objective-C
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 Objective-C Downloads
#import <CkoRest.h>
#import <NSString.h>
BOOL success = NO;
CkoRest *rest = [[CkoRest alloc] init];
BOOL bTls = YES;
BOOL bAutoReconnect = YES;
success = [rest Connect: @"example.com" port: [NSNumber numberWithInt: 443] tls: bTls autoReconnect: bAutoReconnect];
if (success == NO) {
NSLog(@"%@",rest.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.
NSString *responseText = [rest FullRequestNoBody: @"GET" uriPath: @"/api/items/123"];
if (rest.LastMethodSuccess == NO) {
NSLog(@"%@",rest.LastErrorText);
return;
}
NSLog(@"%@",responseText);