I am trying to send POST data using AFNetworking 2.0 using the code:
NSDictionary *loginParameters = @{@"secretKey": @"SECRET_KEY", @"userOrEmail": username, @"password": password};
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager POST:@"https://api.moj.io/v1/login/APP_ID" parameters:loginParameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"object is %@", responseObject);
}failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Failure message is %@", [error localizedDescription]);
}];
This keeps giving me a response saying Request failed: not found (404)
But if I use the Postman REST client (on the chrome browser), using the URL https://api.moj.io/v1/login/APP_ID
and the parameters for secretKey, userOrEmail and password, it gives the correct response.
What is the mistake I am making ?