I’m working on an iPhone application that needs to retrieve revision information from Google Drive documents. The main challenge is that these documents belong to other users, not the person using my app.
What I’m trying to accomplish is getting the revision history data, but I don’t need all the details. I just want to find out when the document was last modified - basically the timestamp of the most recent revision.
Is there a way to fetch this information using the Google Drive API on iOS? I’ve been looking through the documentation but I’m not sure which endpoint or method would work best for this scenario. Any code examples or guidance would be really helpful.
Skip the revisions endpoint - it’s overkill for just getting the last modified timestamp. I hit this same issue a few months ago while building a document tracker. files.get with modifiedTime works great, but also grab lastModifyingUser if you need to know who changed it. Watch out for shared documents though - permissions get messy. The document might be accessible but revision data isn’t, depending on sharing settings. The API returns different detail levels based on each user’s file access.
i tried this last week and hit auth issues with other people’s files. watch out for modifiedTime being null or restricted - happened to me with corporate docs. also check if it’s a shared drive vs personal drive since the api acts differently for each.
You can grab the last modified timestamp without pulling the entire revision history. Just use the Google Drive API’s files.get method and set the fields parameter to ‘modifiedTime’. This keeps your request focused on what you actually need.
Just remember - you’ll need proper permissions for files owned by others. Make sure the document owner has granted your app access and you’re authenticated with OAuth 2.0 using scopes like ‘https://www.googleapis.com/auth/drive.readonly’. I’ve found this approach way more efficient than querying the full revision history.