RKObjectManager *manager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:@"https://172.22.221.117/api/v1.0/"]];
NSDictionary *dictionary=[NSDictionary dictionaryWithObjectsAndKeys:@"abc.com",@"email",@"password",@"password", nil];
[manager postObject:nil
path:@"auth/login"
parameters:dictionary
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
}
failure:^(RKObjectRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
if(operation.HTTPRequestOperation.response.statusCode==200){
//do your processing
}
}];
Question
I am using "RestKit 0.20.3` in my project,
due to some crucial reasons I am going to convert all my API calls to Ret kit,
please can any one tell me how can I make a same call like below with rest kit
I am sending my ASIHHTP
code
please can any one migrate it to Rest kit, I unable to find the way
NSDictionary *dictionary=....;
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@auth/login",KBASEURL]];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setRequestMethod:@"POST"];
[request setValidatesSecureCertificate:NO];
[request addRequestHeader:@"Content-Type" value:@"application/json; charset=utf-8"];
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dataDictionary options:kNilOptions error:nil];
[request setPostBody:(NSMutableData *)jsonData];
[request setContentLength:[jsonData length]];
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow