Cheok Yan Cheng
Cheok Yan Cheng

Reputation: 42828

Efficient Way to perform batch download from Google Doc using Google Document List API

Currently, I have a few hundred image files, hosted in Google Drive.

I wish to have a way for users to download all images in an efficient way. Here is what I did.

Note, I am using a HttpClient + XML parsing instead of using Google Document List API SDK, as the SDK is not supported in Android. I do not use Google Drive SDK, as its feature is very limited compared to Google Document List API.


Request Google Doc to create archive file out from given image files.

I send a POST request to https://docs.google.com/feeds/default/private/archive?v=3, by specificity which image files I want them to be in archive. Once my POST request completed, server will return me <docs:archiveStatus>archiving</docs:archiveStatus>. The server needs time to perform archiving.

Keep quering Google Doc till I get 'finished' status

This is the part where inefficiency is there. Currently, I have no way to know when will the archiving process done, but keep query on the status by using link from previous respond <link rel='self' type='application/atom+xml' href='https://docs.google.com/feeds/default/private/archive/nTSZLt...32zRB3U?v=3.

I need to keep repeating same query again and again, till I get <docs:archiveStatus>finished</docs:archiveStatus>.

Only with that, I can obtain the archive download link through <content type='application/zip' src='https://doc-00-90-docs.googleusercontent.com/docs/secure/he...30&gd=true' />


Is there any efficient way I can use, to avoid multiple queries on the same URL again and again?

Upvotes: 0

Views: 837

Answers (1)

Claudio Cherubino
Claudio Cherubino

Reputation: 15024

The only alternative I can think of would be monitoring the email address specified in the <docs:archiveNotify> element of the archive creation request, but I'm not sure whether that is more efficient.

Upvotes: 1

Related Questions