Partially editing a document in Google Drive - google-drive-api

This is a conceptual question regarding the realtime editing of large files. Imagine we have a 50 Mb txt file in Google Drive that we want to allow users to edit. We require that the user downloads the entire file before they start editing (The user will have to wait for a while, but this is ok). The user then changes a single word in the 50 Mb text file. How can we possibly update the file in Google Drive without uploading all 50 Mb of text.

If you are creating an Android application, the Google Drive Android API handles this differential upload for you behind the scenes.
If you are not using the Android API, it is not currently possible via the Drive RESTful API.

You say the files are "txt" which suggests they are not Google docs. Drive considers all such files to be blobs. so I can't see anyway they can be patched.

Related

File name conversion for cloud storages?

Lets say I have a web URL to a file on a cloud storage (like Dropbox, Google Drive, etc). How do I convert that to the corresponding file path on my pc? On Android? On iOS?
Assuming of course I have the utilities/apps installed locally.
EDIT: I interested in file name the reverse direction too. (I.e. when I have the local file path, what is the web path?)
EDIT 2: #Greg just made me realize that the problem with file name is much worse on Google Drive than on Dropbox.
And that is very bad. :-(
The reason? Google has good search capabilities on Drive and therefor I and many, many others have put their documents on Drive. However, once I found it I must locate it on my on computer/device. (If I want to edit a pdf for example.)
EDIT 3: #Dan McGrath kindly asked what parts remain unsolved.
Short answer: All. ;-)
Long answer: My actual use case, see below.
My actual use case is a Zotero web app. Zotero is a reference database where you store references to scientific articles, web pages, etc. The items stored in Zotero may include PDF files or - which I prefer - links to PDF files.
I just want to be able to easy access (read) this PDF files from any computer through the web app. And on my own computer I want to be able to edit the files with my local PDF editor. (Be it Android, Windows or whatever.)
By using a cloud storage I do not have to download/upload the files myself. The cloud storage takes care of that part.
For the "reverse" scenario, that is, you have a file and you want the Dropbox shared link, you can use this API endpoint, assuming you're connected to the account via the API:
https://www.dropbox.com/developers/core/docs#shares

Upload part of the file to Google drive

Is it possible to change a large file using google drive api, by uploading only changed part of the file, instead of entire file? I tried to find information about it in the API docs, but there's only support for continue uploading after connection reset. It seems to be an important feature.
No it's not possible. The Drive SDK treats files as atomic data blobs. It knows nothing about the format of content and hence what constitutes a change.

How to get an accurate file list through the google drive api

I'm developing an application using the Google drive api (java version). The application saves files on a Google drive mimicking a file system (i.e. has a folder tree). I started by using the files.list() method to retrieve all the existing files on the Google drive but the response got slower as the number of files increased (after a couple of hundred).
The java Google API hardcodes the response timeout to 20 seconds. I changed the code to load one folder at a time recursively instead (using files.list().setQ("'folderId' in parents) ). This method beats the timeout problem but it consistently misses about 2% of the files in my folders (the same files are missing each time). I can see those files through the Google drive web browser interface and even through the Google drive API if I search the file name directly files.list().setQ("title='filename'").
I'm assuming that the "in parents" search uses some inexact indexing which may only be updated periodically. I need a file listing that's more robust and accurate.
Any ideas?
could you utilize the Page mechanism to do multiple times of queries and each query just asks for a small mount of result ?

google drive preview generation while uploading document

Can a google drive application generate a preview for a file (which is not handled by google drive by default) when a file of that type is uploaded by the user, rather than creating it using that application?(Assuming the user has authorized that application)
Unfortunately, no, sorry.
The closest we have is being able to generate a third party thumbnail for a file. Your app can decide how the file will appear in the Google Drive thumbnail view by uploading the necessary image(s).
The video here explains it: http://www.youtube.com/watch?v=jG5-9zlaPL8

Access Google Drive from a desktop application [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Android API for Google Drive?
I want to synchronize a single small xml file between Android application and separate standalone Java-based desktop application. First, a user pushes a button in the Android application and the xml file is stored somewhere in the cloud. Next, the user launches standalone desktop application and gets the xml file from the cloud.
I wanted to use Google Drive for this purpose. However, I am confused about the following from Google Drive help pages:
Warning: Authorization alone is not sufficient to give your app access
to users' files — app installation is also required. Apps will not
have any API access to files unless users have first installed the app
in Chrome Web Store.
Is there a way to directly grab/write a file from/to Google Drive having the credentials? Or at least a way with least problems for the end user?
At the moment, we realize this isn't feasible with the Drive API, as you'd need a token created for a client ID that had been installed from the Chrome Web Store. We are planning a fix for this, but don't have anything immediately. In the immediate term, you should use the Documents List API.