How to retrieve document revision timestamps via Google Drive API in iOS

I’m building an iPhone application that needs to access Google Drive documents. My main challenge is figuring out how to fetch the revision history for documents that belong to other users (not the current app user).

Specifically, I want to get the timestamp of when the document was last modified. I don’t need the full revision details, just the date and time information from the most recent change.

Has anyone worked with the Google Drive API on iOS for this type of functionality? What’s the best approach to retrieve this revision metadata for shared documents?

I had the same problem with shared docs in my iOS app. You need the right OAuth scopes - use https://www.googleapis.com/auth/drive.readonly or full drive scope depending on what you’re doing. For modification timestamps, just use files.get on the document ID and check the modifiedTime field. Way easier than messing with the revisions endpoint, and it works fine for shared docs if the user can view them. Just make sure you handle auth correctly since you’ll need explicit consent through OAuth to access other people’s documents.

Actually, there’s a simpler way - just check the modifiedTime property in the file metadata using GTLRDriveQuery_FilesGet. You don’t need the revisions API unless you want the full history. Just keep in mind that shared file access depends on the owner’s permissions, so some docs might not show modification times even if you can view them.

To retrieve the last modified timestamp for documents via the Google Drive API, you can utilize the revisions endpoint. It’s crucial to ensure your application has the necessary permissions to access documents owned by other users. Use the revisions.list method with a pageSize of 1, ordering by modifiedTime in descending order. This method will efficiently return the most recent revision without unnecessary data. Be mindful that access to revision data can differ based on file types and sharing settings, particularly for Google Docs, Sheets, and Slides compared to regular files, so it’s a good practice to test with documents you own before attempting to access shared ones.