We have an intranet, built in .Net (C#). We would like our CMS to be able to extract the HTML content from a Google Doc to integrate with other content.
Specifically, we want an editor to be able to create and maintain a Google Doc, and embed a reference to this doc (via its ID) into a page on our intranet. When rendering the page, the CMS will contact Google Docs, get the HTML content of the document, and render it as part of the page (yes, there will be caching involved).
I have gone 'round and 'round the GData API. It's harder than I thought.
Authentication is via OAuth, so what we'll do is create another Google Apps user for our CMS, so I can get authenticated.
But once I retrieve a document, there is no HTML in it. There are a variety of properties (including one infuriatingly called "Content." which isn't), but nothing I can see has the actual HTML content of the document. It seems to have all sorts of information about the document, except for the content itself.
Hours of Googling and research tells me that I will likely have to form the export URL, then download it as an HTML file via HTTP. I can do this in a browser -- just paste in the correct URL, and there it is.
But I can't do that from code. I can make an HTTP request, certainly, but it doesn't carry the authentication that I've already been through to get the document object itself.
So, two questions:
- Is there an easier way to do this? I have a nagging suspicion that I'm going about this all wrong.
- How can I make an HTTP request to a Google Docs URL in the context of an authenticated user?