Advertisement
Gustavo_Inzunza

rest oc

Sep 27th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #import <Foundation/Foundation.h>
  2.  
  3. NSDictionary *headers = @{ @"cache-control": @"no-cache",
  4.                            @"postman-token": @"f531b7db-3575-8b1e-653b-d1fb3786aeed" };
  5.  
  6. NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://54.207.80.28/api-lebox/cita/prueba_rest?estudio=1.3.6.1.4.1.18397.10.10.700206911201504131124113"]
  7.                                                        cachePolicy:NSURLRequestUseProtocolCachePolicy
  8.                                                    timeoutInterval:10.0];
  9. [request setHTTPMethod:@"POST"];
  10. [request setAllHTTPHeaderFields:headers];
  11.  
  12. NSURLSession *session = [NSURLSession sharedSession];
  13. NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
  14.                                             completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  15.                                                 if (error) {
  16.                                                     NSLog(@"%@", error);
  17.                                                 } else {
  18.                                                     NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
  19.                                                     NSLog(@"%@", httpResponse);
  20.                                                 }
  21.                                             }];
  22. [dataTask resume];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement