It appears that your Content-Type: application/atom+xml header isn't being honored.
Here's a conversation for October that may help: http://groups.google.com/group/googlehealthdevelopers/browse_thread/thread/3fc92e60474ce4e1/ Eric On Mar 6, 8:49 pm, Try <[email protected]> wrote: > I tried for that, but I found following error each time when I posting > the medication data. > > Content-Type application/x-www-form-urlencoded is not valid. > > I am using following code to post medication data. > > NSString *myStr = [NSString stringWithFormat:@"%...@%@", > @"https://www.google.com/health/feeds/register/ui/", myProfileName]; > > NSMutableURLRequest *httpReq = [[NSMutableURLRequest alloc] > initWithURL:[NSURL URLWithString:myStr] ]; > > [httpReq setTimeoutInterval:30.0]; > > [httpReq setHTTPMethod:@"POST"]; > > [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; > > //NSString *strData=@"<?xml version='1.0' encoding='UTF-8'?><feed > > xmlns='http://www.w3.org/2005/Atom'xmlns:openSearch='http://a9.com/-/ > spec/opensearchrss/1.0/' xmlns:ccr='urn:astm-org:CCR' > xmlns:batch='http://schemas.google.com/gdata/batch'xmlns:h9m='http:// > schemas.google.com/health/metadata'><id>https://www.google.com/health/ > feeds/profile/ui/qjFkYfopm8Y</id><updated>2009-03-06T09:26:46.779Z</ > updated><category scheme='http://schemas.google.com/g/2005#kind' > term='http://schemas.google.com/health/kinds#profile'/><title > type='text'>Profile Feed</title><link rel='http://schemas.google.com/ > g/ > 2005#feed' type='application/atom+xml' href='https://www.google.com/ > health/feeds/profile/ui/qjFkYfopm8Y'/><link rel='http:// > schemas.google.com/g/2005#post' type='application/atom+xml' > href='https://www.google.com/health/feeds/profile/ui/qjFkYfopm8Y'/><link > rel='http://schemas.google.com/g/2005#batch'type='application/ > > atom+xml' href='https://www.google.com/health/feeds/profile/ui/ > qjFkYfopm8Y/batch'/><link rel='self' type='application/atom+xml' > href='https://www.google.com/health/feeds/profile/ui/qjFkYfopm8Y'/><openSearch:startIndex>1</openSearch:startIndex><entry><id>https:// > > www.google.com/health/feeds/profile/ui/qjFkYfopm8Y/GzZ8.Hg3A.g</id><published>2009-03-02T07:30:47.606Z</published><updated>2009-03-03T10:20:41.913Z</updated><category > term='MEDICATION'/><category scheme='http://schemas.google.com/health/ > item' term='A& D Barrier'/><category scheme='http:// > schemas.google.com/g/2005#kind' term='http://schemas.google.com/ > health/ > kinds#profile'/><title type='text'></title><content type='html'></ > content><link rel='http://schemas.google.com/health/data#complete' > type='application/atom+xml' href='https://www.google.com/health/feeds/ > profile/ui/qjFkYfopm8Y/-/MEDICATION/%7Bhttp%3A%2F%2Fschemas.google.com > %2Fhealth%2Fitem%7DA%26+D+Barrier/%7Bhttp%3A%2F%2Fschemas.google.com > %2Fg%2F2005%23kind%7Dhttp%3A%2F%2Fschemas.google.com%2Fhealth%2Fkinds > %23profile'/><link rel='self' type='application/atom+xml' > href='https://www.google.com/health/feeds/profile/ui/qjFkYfopm8Y/ > GzZ8.Hg3A.g'/><link rel='edit' type='application/atom+xml' > href='https://www.google.com/health/feeds/profile/ui/qjFkYfopm8Y/ > GzZ8.Hg3A.g'/><author><name>try_calendar Elan</ > name><email>[email protected]</email></ > author><contributor><name>try_calendar Elan</ > name><email>[email protected]</email></ > contributor><ContinuityOfCareRecord xmlns='urn:astm- > org:CCR'><CCRDocumentObjectID>GzZ8.Hg3A.g</ > CCRDocumentObjectID><Language><Text>English</Text><Code><Value>en</ > Value><CodingSystem>ISO-639-1</CodingSystem></Code></ > Language><Version>V1.0</ > Version><DateTime><ExactDateTime>2009-03-02T07:30:47.606Z</ > ExactDateTime></DateTime><Patient><ActorID>Google Health Profile</ > ActorID></Patient><From><ActorLink><ActorID>Google Health</ > ActorID><ActorRole><Text>PHR</Text></ActorRole></ActorLink></ > From><Body><Medications><Medication><CCRDataObjectID>GzZ8.Hg3A.g-0</ > CCRDataObjectID><DateTime><Type><Text>Start date</Text></ > Type><ExactDateTime>2009-03-10</ExactDateTime></ > DateTime><DateTime><Type><Text>Stop date</Text></ > Type><ExactDateTime>2009-03-11</ExactDateTime></ > DateTime><Status><Text>ACTIVE</Text></ > Status><Source><Actor><ActorID>[email protected]</ > ActorID><ActorRole><Text>Patient</Text></ActorRole></ > Actor><Actor><ActorID>[email protected]</ > ActorID><ActorRole><Text>Patient</Text></ActorRole></Actor></ > Source><Product><ProductName><Text>A& D Barrier</ > Text><Code><Value>86385</Value><CodingSystem>FDB_routed</ > CodingSystem></Code><Code><Value>464143</ > Value><CodingSystem>FDB_dispensable</CodingSystem></ > Code><Code><Value>21.124854</Value><CodingSystem>Google</ > CodingSystem></Code><Code><Value>238361</Value><CodingSystem>RxNorm</ > CodingSystem></Code><Code><Value>08333338701</ > Value><CodingSystem>NDC</ > CodingSystem></Code><Code><Value>20.75531</ > Value><CodingSystem>Google</ > CodingSystem></Code><Code><Value>19.42882</ > Value><CodingSystem>Google</ > CodingSystem></Code><Code><Value>72771</Value><CodingSystem>FDB</ > CodingSystem></Code></ProductName><Form><Text>Ointment</ > Text><FormSequencePosition>0</FormSequencePosition></Form></ > Product><Directions><Direction><Dose><Value>2</ > Value><DoseSequencePosition>0</DoseSequencePosition></ > Dose><Route><Text>To skin</Text><Code><Value>22.16444</ > Value><CodingSystem>Google</CodingSystem></Code><Code><Value>30</ > Value><CodingSystem>FDB</CodingSystem></Code><Code><Value>C38305</ > Value><CodingSystem>FDA</CodingSystem></ > Code><RouteSequencePosition>0</ > RouteSequencePosition></Route><Frequency><Value>1 time per day in the > evening</Value><FrequencySequencePosition>0</ > FrequencySequencePosition></Frequency></Direction></Directions></ > Medication></Medications></Body><Actors><Actor><ActorObjectID>Google > Health Profile</ > ActorObjectID><Source><Actor><ActorID>[email protected]</ > ActorID><ActorRole><Text>Patient</Text></ActorRole></ > Actor><Actor><ActorID>[email protected]</ > ActorID><ActorRole><Text>Patient</Text></ActorRole></Actor></Source></ > Actor></Actors></ContinuityOfCareRecord><ProfileMetaData > xmlns='http:// > schemas.google.com/health/metadata'><UserComment type='text' > src='IRI'>Medication Description</UserComment><FrequencyValue > value='1.000000'/><FrequencyType value='1'/></ProfileMetaData></ > entry><entry><id>https://www.google.com/health/feeds/profile/ui/ > qjFkYfopm8Y/51L.E.ivG3M</id><published>2009-03-03T10:02:26.630Z</ > published><updated>2009-03-03T10:02:26.630Z</updated><category > term='MEDICATION'/><category scheme='http://schemas.google.com/g/ > 2005#kind' term='http://schemas.google.com/health/kinds#profile'/><category > scheme='http://schemas.google.com/health/item'term='A-200 > > Lice Killing'/><title type='text'></title><content type='html'></ > content><link rel='http://schemas.google.com/health/data#complete' > type='application/atom+xml' href='https://www.google.com/health/feeds/ > profile/ui/qjFkYfopm8Y/-/MEDICATION/%7Bhttp%3A%2F%2Fschemas.google.com > %2Fg%2F2005%23kind%7Dhttp%3A%2F%2Fschemas.google.com%2Fhealth%2Fkinds > %23profile/%7Bhttp%3A%2F%2Fschemas.google.com%2Fhealth%2Fitem > %7DA-200+Lice+Killing'/><link rel='self' type='application/atom+xml' > href='https://www.google.com/health/feeds/profile/ui/qjFkYfopm8Y/ > 51L.E.ivG3M'/><link rel='edit' type='application/atom+xml' > href='https://www.google.com/health/feeds/profile/ui/qjFkYfopm8Y/ > 51L.E.ivG3M'/><author><name>try_calendar Elan</ > name><email>[email protected]</email></ > author><contributor><name>try_calendar Elan</ > name><email>[email protected]</email></ > contributor><ContinuityOfCareRecord xmlns='urn:astm- > org:CCR'><CCRDocumentObjectID>51L.E.ivG3M</ > CCRDocumentObjectID><Language><Text>English</Text><Code><Value>en</ > Value><CodingSystem>ISO-639-1</CodingSystem></Code></ > Language><Version>V1.0</ > Version><DateTime><ExactDateTime>2009-03-03T10:02:26.630Z</ > ExactDateTime></DateTime><Patient><ActorID>Google Health Profile</ > ActorID></Patient><From><ActorLink><ActorID>Google Health</ > ActorID><ActorRole><Text>PHR</Text></ActorRole></ActorLink></ > From><Body><Medications><Medication><CCRDataObjectID>51L.E.ivG3M-0</ > CCRDataObjectID><Status><Text>ACTIVE</Text></ > Status><Source><Actor><ActorID>[email protected]</ > ActorID><ActorRole><Text>Patient</Text></ActorRole></ > Actor><Actor><ActorID>[email protected]</ > ActorID><ActorRole><Text>Patient</Text></ActorRole></Actor></ > Source><Product><ProductName><Text>A-200 Lice Killing</ > Text><Code><Value>61912</Value><CodingSystem>FDB_routed</ > CodingSystem></Code><Code><Value>20.71934</ > Value><CodingSystem>Google</ > CodingSystem></Code><Code><Value>19.40009</ > Value><CodingSystem>Google</ > CodingSystem></Code><Code><Value>54761</Value><CodingSystem>FDB</ > CodingSystem></Code></ProductName></ > Product><Directions><Direction><Route><Text>To skin</ > Text><Code><Value>22.16444</Value><CodingSystem>Google</ > CodingSystem></ > Code><Code><Value>30</Value><CodingSystem>FDB</CodingSystem></ > Code><Code><Value>C38305</Value><CodingSystem>FDA</CodingSystem></ > Code><RouteSequencePosition>0</RouteSequencePosition></Route></ > Direction></Directions></Medication></Medications></ > Body><Actors><Actor><ActorObjectID>Google Health Profile</ > ActorObjectID><Source><Actor><ActorID>[email protected]</ > ActorID><ActorRole><Text>Patient</Text></ActorRole></Actor></Source></ > Actor></Actors></ContinuityOfCareRecord><ProfileMetaData > xmlns='http:// > schemas.google.com/health/metadata'><UserComment type='text' > src='IRI'></UserComment></ProfileMetaData></entry><entry><id>https://www.google.com/health/feeds/profile/ui/qjFkYfopm8Y/.J9y4T_nOvY</id><published>2009-03-03T10:02:29.917Z</published><updated>2009-03-03T10:02:29.918Z</updated><category > term='MEDICATION'/><category scheme='http://schemas.google.com/g/ > 2005#kind' term='http://schemas.google.com/health/kinds#profile'/ > > ><category scheme='http://schemas.google.com/health/item'term='A- > > ... > > read more » --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
