I want to send POST request to a web service from my iOS app. So far, I have sent a JSON object and it is working. Now I want to send data as parameters. I did something like this.
[request setValue:@"application/json;charset=UTF-8" forHTTPHeaderField:@"Content-Type"];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[NSData dataWithBytes:[postParam UTF8String] length:[postParam length]]];
NSError *error = nil;
NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error: &error];
NSString *string = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding];
This is my postParam
string
action=approve&requestId=0&reqDetailId=21&nextApproverCode=0&authIpAddress=122.127.0.114&remarks=Test&approval=C
This is my request
<NSMutableURLRequest: 0x151323e60> { URL: http://<url>/Workflows/WorkflowApprovals? }
But I'm getting an error message
{"Message":"No HTTP resource was found that matches the request URI 'http://<url>/Workflows/WorkflowApprovals'."}
What is the reason for this?
Thanks in advance