Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on May 22nd, 2013  |  syntax: Objective C  |  size: 1.87 KB  |  views: 34  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //vimeo.videos.upload.getTicket
  2.         NSURL *ticketRequestURL = [NSURL URLWithString:@"http://vimeo.com/api/rest/v2?format=json&method=vimeo.videos.upload.getTicket"];
  3.         NSMutableURLRequest *ticketRequest = [NSMutableURLRequest requestWithURL:ticketRequestURL];
  4.         [ticketRequest setHTTPMethod:@"POST"];
  5.         [auth authorizeRequest:ticketRequest];
  6.         [NSURLConnection sendAsynchronousRequest:ticketRequest queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *ticketRequestResponse, NSData *ticketRequestData, NSError *ticketRequestError) {
  7.             NSString *ticketRequestResponseString = [[NSString alloc] initWithData:ticketRequestData encoding:NSStringEncodingConversionAllowLossy];
  8.             NSDictionary *d = [[parser objectWithString:ticketRequestResponseString] objectForKey:@"ticket"];
  9.             NSString *identifier = [d objectForKey:@"id"];
  10.             //vimeo.videos.upload.checkTicket
  11.             NSURL *ticketCheckRequestURL = [NSURL URLWithString:@"http://vimeo.com/api/rest/v2?format=json&method=vimeo.videos.upload.checkTicket"];
  12.             NSMutableURLRequest *ticketCheckRequest = [NSMutableURLRequest requestWithURL:ticketCheckRequestURL];
  13.             [ticketCheckRequest setHTTPMethod:@"POST"];
  14.             [ticketCheckRequest setValue:identifier forHTTPHeaderField:@"ticket_id"];
  15.  
  16.             [auth authorizeRequest:ticketCheckRequest];
  17.             [NSURLConnection sendAsynchronousRequest:ticketCheckRequest queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *ticketRequestResponse, NSData *ticketRequestData, NSError *ticketRequestError) {
  18.                 NSString *ticketCheckRequestResponseString = [[NSString alloc] initWithData:ticketRequestData encoding:NSStringEncodingConversionAllowLossy];
  19.                 NSLog(@"%@", ticketCheckRequestResponseString);
  20.                
  21.             }];
  22.         }];
clone this paste RAW Paste Data