(Objective-C) HTTP DELETE with Body
Demonstrates how to send a DELETE request with a body.
#import <CkoHttp.h>
#import <NSString.h>
#import <CkoHttpResponse.h>
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkoHttp *http = [[CkoHttp alloc] init];
// Use the PText method (or PTextSb) to send a DELETE request with a body.
NSString *requestBody = @"{ \"abc\": 123 }";
CkoHttpResponse *resp = [http PText: @"DELETE" url: @"https://example.com/something" textData: requestBody charset: @"utf-8" contentType: @"application/json" md5: NO gzip: NO];
if (http.LastMethodSuccess == NO) {
NSLog(@"%@",http.LastErrorText);
return;
}
NSLog(@"%@%d",@"Response status: ",[resp.StatusCode intValue]);
NSLog(@"%@",@"Response body: ");
NSLog(@"%@",resp.BodyStr);
|