I am trying with ClientLogin to Build HTTP Delete request. I don't
know how to do it. I just put some code togerther to start listing the
feed contents. But I get an exception at this line:
HealthFeed feed = service.Query(new
HealthQuery(HealthQuery.ProfileListFeed)); Can someone please help me
how I can list the context and then delete a specfic entry.
Google.GData.Client.GDataRequestException: Execution of request
failed: https://
www.google.com/health/feeds/profile/list ---> System.Net.WebException:
The remot
e server returned an error: (403) Forbidden.
at System.Net.HttpWebRequest.GetResponse()
at Google.GData.Client.GDataRequest.Execute()
--- End of inner exception stack trace ---
at Google.GData.Client.GDataRequest.Execute()
at Google.GData.Client.GDataGAuthRequest.Execute(Int32
retryCounter)
at Google.GData.Client.GDataGAuthRequest.Execute()
at Google.GData.Client.Service.Query(Uri queryUri, DateTime
ifModifiedSince,
String etag, Int64& contentLength)
at Google.GData.Client.Service.Query(Uri queryUri, DateTime
ifModifiedSince)
at Google.GData.Client.Service.Query(FeedQuery feedQuery)
at Google.GData.Health.HealthService.Query(HealthQuery feedQuery)
at ConsoleApplication3.Program.Main(String[] args) in C:\Inetpub
\wwwroot\Cons
oleApplication3\ConsoleApplication3\Program.cs:line 143
The code is:
static void Main(string[] args)
{
HealthService service = new HealthService("google-spx-v1");
service.setUserCredentials("[email protected]", "myPwd");
GDataGAuthRequestFactory reqFactory =
(GDataGAuthRequestFactory)service.RequestFactory;
reqFactory.ProtocolMajor = 3;
AtomEntry newNotice = new AtomEntry();
newNotice.Title.Text = "A test message";
newNotice.Content.Content = "This is a test message.";
// Set the content type if you're using HTML in your
message body
newNotice.Content.Type = "html";
String ccrXmlString = @"<ContinuityOfCareRecord
xmlns='urn:astm-org:CCR'><CCRDocumentObjectID>100</
CCRDocumentObjectID>
<Language>
<Text>English</Text>
<Code>
<Value>en</Value>
<CodingSystem>ISO-639-1</CodingSystem>
</Code>
</Language>
<Version>V1.0</Version>
<DateTime>
<Type />
<ExactDateTime>2009-05-25T11:57:20Z</ExactDateTime>
</DateTime>
<Patient>
<ActorID>D6E5D510-592D-C613-DB46-A4CF2AC91C1D</ActorID>
</Patient>
<Body>
<Medications>
<Medication>
<DateTime>
<Type>
<Text>Start Date</Text>
</Type>
<ExactDateTime>2009-05-25T11:57:20Z</ExactDateTime>
</DateTime>
<DateTime>
<Type>
<Text>Stop Date</Text>
</Type>
<ExactDateTime>2009-06-25T11:57:20Z</ExactDateTime>
</DateTime>
<Status>
<Text>Active</Text>
</Status>
<Source>
<Actor>
<ActorID>VRao</ActorID>
<ActorRole>
<Text>Prescribing clinician Dr. Thomas</Text>
</ActorRole>
</Actor>
</Source>
<Product>
<ProductName>
<Text>TIZANIDINE HCL 2 MG TABLET TEV</Text>
<Code>
<Value>1</Value>
<CodingSystem>omi-coding</CodingSystem>
</Code>
</ProductName>
<Strength>
<Value>2</Value>
<Units>
<Unit>MG</Unit>
</Units>
</Strength>
</Product>
<Directions>
<Direction>
<Dose>
<Value>1</Value>
<Units>
<Unit>tablet</Unit>
</Units>
</Dose>
<Route>
<Text>Oral</Text>
</Route>
<Frequency>
<Value>1 time per day</Value>
</Frequency>
</Direction>
</Directions>
<FulfillmentHistory>
<Fulfillment>
<DateTime>
<Type>
<Text>Dispense date</Text>
</Type>
<ExactDateTime>2009-08-02T07:00:00Z</ExactDateTime>
</DateTime>
<Quantity>
<Value>30</Value>
<Units>
<Unit>Tablet</Unit>
</Units>
</Quantity>
</Fulfillment>
</FulfillmentHistory>
</Medication>
</Medications>
</Body>
<Actors>
<Actor>
<ActorObjectID>D6E5D510-592D-C613-DB46-A4CF2AC91C1D</
ActorObjectID>
</Actor>
</Actors>
</ContinuityOfCareRecord>";
XmlDocument ccrDoc = new XmlDocument();
ccrDoc.LoadXml(ccrXmlString);
newNotice.ExtensionElements.Add(new
XmlExtension(ccrDoc.DocumentElement));
try
{
HealthFeed feed = service.Query(new
HealthQuery(HealthQuery.ProfileListFeed));
foreach (AtomEntry entry in feed.Entries)
{
Console.WriteLine("\tProfile " + entry.Title.Text +
" has ID: " + entry.Content.Content);
}
}
catch(GDataRequestException e)
{
Console.WriteLine(e);
Console.WriteLine("done wirting exception");
}
}
--
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.