Hi,
I am testing solution to access Domino data via iOS native application. According documentation, I make a iOS app to read data form Domino, it is perfect working. But I have problem to PUT/POST doc because authentication.
So, my question is: How to do basic authentication “HTTP Authorization header” or session authentication?
I search on internet and found something as below, but system response require name&password.
NSString *bytes = [NSString stringWithFormat:@“{"DocType":"TestByREST","Form":"RESTForm"}“];
NSURL *url=[NSURL URLWithString:@"http://myServerAddress:80/myDominoDB.nsf/api/data/collections"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setValue:@"Basic eWFuZxUyMGxpJTNBdGlhb3BlcSU3RTU2" forHTTPHeaderField:@"Authorization"];
[request setHTTPMethod:@"POST"];
NSData *req=[NSData dataWithBytes:[bytes UTF8String] length:[bytes length]];
[request setHTTPBody:req];
NSData * responseData = nil;
responseData = [NSMutableData data];
NSURLResponse* response;
NSError* error = nil;
responseData = [NSURLConnection sendSynchronousRequest:request
returningResponse:&response
error:&error];
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(@"the final output is:%@",responseString);
===================
I also try add user name & password in url, like:
http://myServerAddress:80/names.nsf?login&username=xxxxxx&password=xxxxxx&redirectto=myDominoDB.nsf/api/data/documents”];
But not work also.
Anybody can help? It is great if can provide some example codes (Object-C is perfect) to PUT/POST/DELETE documents by Domino.
Thanks again to develop this REST service, it make domino able to extend to mobile device.