Hi ,
I want the profile response from google health in JSON
format ,below is my code so where i have to wright alt=JSON i have
tried
NSString *myStr = [NSString stringWithFormat:@"%...@%@", @"https://
www.google.com/health/feeds/profile/ui& alt=JSON", myProfileName];
but i got response "Badly formated URL". Please help me ....
I m implementing google health in objective c.
-(void)getProfile
{
NSString *myStr = [NSString stringWithFormat:@"%...@%@", @"https://
www.google.com/health/feeds/profile/ui/", myProfileName];
//NSString *myStr = [NSString stringWithFormat:@"%...@%@", @"https://
www.google.com/health/feeds/profile/default/", @"-/medication"];
//[myStr appendString:myProfileName];
NSMutableURLRequest *httpReq = [[NSMutableURLRequest alloc]
initWithURL:[NSURL URLWithString:myStr] ];
[httpReq setTimeoutInterval:30.0];
//[httpReq setCachePolicy:NSURLRequestReloadIgnoringCacheData];
[httpReq setHTTPMethod:@"GET"];
//set headers
[httpReq addValue:@"Content-Type" forHTTPHeaderField:@"application/
atom+xml"];
NSString* param = [NSString stringWithFormat:@"GoogleLogin auth=%@",
[parameter objectForKey:@"Auth"]];
[httpReq setValue:param forHTTPHeaderField: @"Authorization"];
[httpReq addValue:@"Authorization" forHTTPHeaderField:param];
NSHTTPURLResponse *response = nil;
NSData *data = nil;
NSError *error = nil;
NSString* responseStr;
//NSArray *responseLines = nil;
data = [NSURLConnection sendSynchronousRequest:httpReq
returningResponse:&response error:&error];
if( [data length] >0)
responseStr = [[NSString alloc] initWithData:data
encoding:NSASCIIStringEncoding];
//[self parseData:data];
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Health Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/googlehealthdevelopers?hl=en
-~----------~----~----~----~------~----~------~--~---