How do I send a POST
request with AFNetworking
2.0 with all the parameters in the URL like such:
http://www.myserver.com?api_key=something&
can you try this.
NSString* apiURL = @"http://example.com"
AFHTTPRequestOperationManager *manager = [[AFHTTPRequestOperationManager alloc] initWithBaseURL:[NSURL URLWithString:apiURL]];
manager.responseSerializer = [AFJSONResponseSerializer serilizer];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"application/json"];
NSDictionary *parameters = @{@"name":@"John",@"date":"27/12/2013"};
AFHTTPRequestOperation *apiRequest = [manager POST:@"" parameters:params constructingBodyWithBlock:^(id formData) {
} success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog@"response ---%@,responseObject";
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
}];
[apiRequest start];