There is an api
that I need to post the geoPoint
, then get data, which works fine on Postman
. Like shown in the image,
this api works fine on Postman
In my code, I use the following way to call api
NSArray *geoPoint = @[@114.33f, @22.44f];
NSDictionary *geoPointDic = @ {@"geoPoint" : geoPoint};
NSDictionary *inData = @{
@"action" : @"getNearbyEventList",
@"data" : geoPointDic};
NSDictionary *parameters = @{@"data" : inData};
NSLog(@"geoPoint is %@", geoPoint);
NSLog(@"upcoming events parameters %@", parameters);
[_manager POST:GetURL parameters:parameters progress:nil success:^(NSURLSessionDataTask * _Nonnull task, NSDictionary * responseObject) {
NSLog(@"responseObject is %@", responseObject);
NSLog(@"responseObject - data is %@", responseObject[@"data"]);
NSArray *eventsArray = responseObject[@"data"];
But the output is
when NSLog
parameters:
events parameters {
data = {
action = getNearbyEventList;
data = {
geoPoint = (
"114.33",
"22.44"
);
};
};
}
I guess my parameters might be in wrong format, so I tried the following way, but no one works
//NSArray *geoPoint = [[NSArray alloc] init];
//NSArray *geoPoint = [[NSArray alloc] initWithObjects:@"114", @"22", nil];
//NSMutableArray *geoPoint = [[NSMutableArray alloc] init];
//[geoPoint addObject:@114];
//[geoPoint addObject:@22];
//NSArray *geoPoint = [[NSArray alloc] initWithObjects:@"114", @"22", nil];
//NSString *geoPoint = @"[114.33,22.44]";
So, could anyone tell me how to get the data like shown in the Postman
, please?
Thanks a lot!