I am trying to send a http url request of method type 'PATCH' below is my sample code .
NSString *urlString=@"http://0.0.0.0:8000/v1/APvk";
para=[para stringByAppendingFormat:@"/%@?accessToken=",@"SOMEID"];
para= [para stringByAppendingString:@"SOMEACCESSTOKEN"];
NSURL *url = [NSURL URLWithString:para];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
if (!request) NSLog(@"Error creating the URL Request");
[request setHTTPMethod:@"PATCH"];
[request setHTTPBody:data];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
// Send a synchronous request
NSURLResponse * response = nil;
NSError * NSURLRequestError = nil;
NSData * responseData = [NSURLConnection sendSynchronousRequest:request
returningResponse:&response
error:&NSURLRequestError];
NSLog(@"%@",responseData);
NSDictionary *Replyfromserver=[NSJSONSerialization JSONObjectWithData:responseData options:0 error:nil];
NSLog(@"%@",Replyfromserver);
I don't know how to send a PATCH request I am just doing the same way we send a POST request ,here I am getting a message from server that is "Invalid Payload" Help me out of this.