Skip to content

Commit

Permalink
committed 4 method for testing purpose
Browse files Browse the repository at this point in the history
committed 4 method for testing purpose
  • Loading branch information
graut committed Jul 14, 2016
1 parent 49dde8d commit c396e6b
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions iOSFile/AgileSDK/AgileSDK/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ - (void)didReceiveMemoryWarning {
// Dispose of any resources that can be recreated.
}
- (IBAction)getContactById:(id)sender {
NSLog(@"hello12");
NSURL *url = [NSURL URLWithString: @"https://ghanshyam.agilecrm.com/dev/api/contacts/5745057659355136"];
NSLog(@"Get Contact By ID");
NSURL *url = [NSURL URLWithString: @"https://{your_domain}.agilecrm.com/dev/api/contacts/5745057659355136"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];

[request setHTTPMethod:@"GET"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];

NSString *authStr = [NSString stringWithFormat:@"%@:%@", @"ghanshyam.raut@agilecrm.com", @"123456"];
NSString *authStr = [NSString stringWithFormat:@"%@:%@", @"your_user_email", @"your_rest_api_key"];
NSData *authData = [authStr dataUsingEncoding:NSUTF8StringEncoding];
NSString *authValue = [NSString stringWithFormat:@"Basic %@", [authData base64EncodedStringWithOptions:0]];
[request setValue:authValue forHTTPHeaderField:@"Authorization"];
Expand All @@ -54,15 +54,15 @@ - (IBAction)getContactById:(id)sender {

- (IBAction)deleteContactById:(id)sender {

NSLog(@"hello12");
NSURL *url = [NSURL URLWithString: @"https://ghanshyam.agilecrm.com/dev/api/contacts/5680432024649728"];
NSLog(@"delete contact by ID");
NSURL *url = [NSURL URLWithString: @"https://{your_domain}.agilecrm.com/dev/api/contacts/5680432024649728"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];

[request setHTTPMethod:@"DELETE"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];

NSString *authStr = [NSString stringWithFormat:@"%@:%@", @"ghanshyam.raut@agilecrm.com", @"123456"];
NSString *authStr = [NSString stringWithFormat:@"%@:%@", @"your_user_email", @"your_rest_api_key"];
NSData *authData = [authStr dataUsingEncoding:NSUTF8StringEncoding];
NSString *authValue = [NSString stringWithFormat:@"Basic %@", [authData base64EncodedStringWithOptions:0]];
[request setValue:authValue forHTTPHeaderField:@"Authorization"];
Expand Down Expand Up @@ -92,11 +92,10 @@ - (IBAction)createContact:(id)sender {
options:0 error:NULL];

NSLog(@"jsonObject=%@", jsonObject);
NSLog(@"hello12");


NSData *requestData = [colorArray dataUsingEncoding:NSUTF8StringEncoding];

NSURL *url = [NSURL URLWithString: @"https://ghanshyam.agilecrm.com/dev/api/contacts"];
NSURL *url = [NSURL URLWithString: @"https://{your_domain}.agilecrm.com/dev/api/contacts"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];

[request setHTTPMethod:@"POST"];
Expand All @@ -105,7 +104,7 @@ - (IBAction)createContact:(id)sender {
[request setValue:[NSString stringWithFormat:@"%d", [requestData length]] forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody: requestData];

NSString *authStr = [NSString stringWithFormat:@"%@:%@", @"ghanshyam.raut@agilecrm.com", @"123456"];
NSString *authStr = [NSString stringWithFormat:@"%@:%@", @"your_user_email", @"your_rest_api_key"];
NSData *authData = [authStr dataUsingEncoding:NSUTF8StringEncoding];
NSString *authValue = [NSString stringWithFormat:@"Basic %@", [authData base64EncodedStringWithOptions:0]];
[request setValue:authValue forHTTPHeaderField:@"Authorization"];
Expand Down Expand Up @@ -135,11 +134,10 @@ - (IBAction)updateContactById:(id)sender {
options:0 error:NULL];

NSLog(@"jsonObject=%@", jsonObject);
NSLog(@"hello12");


NSData *requestData = [colorArray dataUsingEncoding:NSUTF8StringEncoding];

NSURL *url = [NSURL URLWithString: @"https://ghanshyam.agilecrm.com/dev/api/contacts/edit-properties"];
NSURL *url = [NSURL URLWithString: @"https://{your_domain}.agilecrm.com/dev/api/contacts/edit-properties"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];

[request setHTTPMethod:@"PUT"];
Expand All @@ -148,7 +146,7 @@ - (IBAction)updateContactById:(id)sender {
[request setValue:[NSString stringWithFormat:@"%d", [requestData length]] forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody: requestData];

NSString *authStr = [NSString stringWithFormat:@"%@:%@", @"ghanshyam.raut@agilecrm.com", @"123456"];
NSString *authStr = [NSString stringWithFormat:@"%@:%@", @"your_user_email", @"your_rest_api_key"];
NSData *authData = [authStr dataUsingEncoding:NSUTF8StringEncoding];
NSString *authValue = [NSString stringWithFormat:@"Basic %@", [authData base64EncodedStringWithOptions:0]];
[request setValue:authValue forHTTPHeaderField:@"Authorization"];
Expand Down

0 comments on commit c396e6b

Please sign in to comment.