You want to call a web service using the HTTP DELETE method to delete a resource from a URL, and perhaps pass parameters, as part of the HTTP body or in the query string, to the web service.
Just as with the GET and POST methods, you can use the DELETE
must explicitly set your URL’s method to DELETE.
Figure 8-4. The DELETE web service opened in a web browser
This web service expects DELETE requests (but it’s just a dummy service, so it doesn’t delete any resources). It can print out parameters that are sent as part of the query string and as part of the HTTP body, so you can send both types in the same request. Let’s write a simple app that can create an asynchronous connection and send a few parameters as a query string and a few parameters in the HTTP body to the aforementioned URL, using the DELETE HTTP method:
NSString *urlAsString = @"http://pixolity.com/delete.php"; urlAsString = [urlAsString stringByAppendingString:@"?param1=First"]; urlAsString = [urlAsString stringByAppendingString:@"¶m2=Second"]; NSURL *url = [NSURL URLWithString:urlAsString]; NSMutableURLRequest *urlRequest ...