Skip to content

Instantly share code, notes, and snippets.

@andr-ggn
Created April 15, 2014 13:18
Show Gist options
  • Save andr-ggn/10731899 to your computer and use it in GitHub Desktop.
Save andr-ggn/10731899 to your computer and use it in GitHub Desktop.
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@"http://optimizerapi.ds.trustsourcing.com"]];
NSMutableURLRequest *request = [httpClient requestWithMethod:@"GET"
path:@"/Api/RestorePassword"
parameters:@{@"email":@"[email protected]"}];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[httpClient registerHTTPOperationClass:[AFHTTPRequestOperation class]];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
// Print the response body in text
NSLog(@"Response: %@", [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
[operation start];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment