Advertisement
Guest User

Untitled

a guest
Jul 5th, 2015
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. curl -H 'Authorization: Token token="replace-with-token"' http://domain.com/books
  2.  
  3. NSURL *url = [NSURL URLWithString:@"http://domain.com/books"];
  4. config = [NSURLSessionConfiguration defaultSessionConfiguration];
  5. [config setHTTPAdditionalHeaders:@{@"token":@"4959a0bc00a15e335fb6"}];
  6. NSURLSession *session = [NSURLSession sessionWithConfiguration:config];
  7. [[session dataTaskWithURL:url completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  8. NSLog(@"%@", [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]);
  9. }] resume];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement