Search code examples
.netgoogle-docsgoogle-docs-api

Bad Request when querying revisions


I'm trying to follow the instructions laid out in this post, but I'm not able to make it work.

The constructor for the RevisionQuery takes in a string, but the entry.RevisionDocument is a Uri. I just used .ToString(), but now I'm getting an error - The remote server returned an error: (400) Bad Request - when I try to execute the query (RevisionFeed revisions = service.Query(revisionQuery)). The Uri is set to http://docs.google.com/feeds/default/private/full/document:{id}/revisions. Is that the correct Uri for getting the revisions from a document? When I go to the url in a browser, I get the same error.

I believe I've set up my service by using the proper credentials, but I'm sure I'm just missing something small. Any help would be greatly appreciated. I have a number of docs that I need to publish, and doing them by hand would be quite painful.

Thanks!


Solution

  • The property entry.RevisionDocument is actually a string:

    http://code.google.com/p/google-gdata/source/browse/trunk/clients/cs/src/documents3/documententry.cs#373

    It can be used in the RevisionQuery constructor, as shown in the docs at https://developers.google.com/google-apps/documents-list/#managing_revisions_of_documents_and_files, and as in the following snippet:

    RevisionQuery revisionQuery = new RevisionQuery(entry.RevisionDocument);
    RevisionFeed revisions = service.Query(revisionQuery);