Sample code for 30+ languages & platforms
Objective-C

HTTP DELETE with Body

See more HTTP Examples

Demonstrates how to send a DELETE request with a body.

Chilkat Objective-C Downloads

Objective-C
#import <CkoHttp.h>
#import <NSString.h>
#import <CkoHttpResponse.h>

BOOL success = NO;

// 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 HttpStr method (or HttpSb) to send a DELETE request with a body.
NSString *requestBody = @"{ \"abc\": 123 }";
CkoHttpResponse *resp = [[CkoHttpResponse alloc] init];
success = [http HttpStr: @"DELETE" url: @"https://example.com/something" bodyStr: requestBody charset: @"utf-8" contentType: @"application/json" response: resp];
if (success == NO) {
    NSLog(@"%@",http.LastErrorText);
    return;
}

NSLog(@"%@%d",@"Response status: ",[resp.StatusCode intValue]);
NSLog(@"%@",@"Response body: ");
NSLog(@"%@",resp.BodyStr);