Start a new topic

Custom endpoint not able to form request object

Dear Kinvey,



Can we pass Arrays/Objects as parameters to KCSCustomEndpoint? Because, when I do this, I get an error saying "There request body is empty or incomplete" error.



[KCSCustomEndpoints callEndpoint:@"giveTheseUsersAccessToPictures" params:@{@"picture":self.pictureObject,@"invitees":self.inviteeList} completionBlock:^(id results, NSError *error) {



NSLog(@"Picture object...%@",self.pictureObject);



if (!error) {



NSLog(@"CUSTOME ENDPOINT...%@",results);

}else{

NSLog(@"CUSTOM ENPOINT ERROR...%@",error);

}

}];



Thank you,

All the objects have to be JSON-types: NSNumber, NSString, NSDictionary, NSArray. Any values in an array or dictionary have to be one of those types too.
Thank you for responding. So the above code should work right?
as long as self.pictureObject is one of those basic types and everything inside self.inviteeList is too
Hi Harish

You need to pass in the parameters as a dictionary

Find below an example:



_dict = [[NSDictionary alloc] initWithObjectsAndKeys:_username,@"userName",[NSNumber numberWithInt:skip],@"skip", nil];

NSString* string = @"userSelfiesPopular";



[KCSCustomEndpoints callEndpoint:string params:_dict completionBlock:^(id results, NSError *error) {



if (results) {



//load is successful!



} else {



//load failed



}



}];

Login or Signup to post a comment