I’m trying to fetch document details using the Google Docs API. I’ve successfully called documents.get with the right documentId and got the document body. But there’s a problem: the @date field is missing from the JSON response.
Is there a way to include the @date in the API response? I’ve heard that using Google Drive’s export feature to get the doc as PDF or TXT might help, but I’m not sure. Any ideas on how to get this working within the API itself?
I’ve encountered a similar issue when trying to retrieve the @date field from a Google Docs API call. In practice, the documents.get method does not return that metadata. A solution I found involves working with both the Drive API and the Docs API. By using the Drive API’s files.get method with the same documentId, you can extract metadata such as createdTime and modifiedTime. Afterwards, you can retrieve the document content using the Docs API and merge both pieces of information in your application logic. Although this method introduces an extra step, it reliably provides the date details you’re looking for.
hey alexj, i’ve run into this too. the docs API doesn’t give you that @date field directly. but here’s a trick - use the drive API instead. call files.get with your doc ID and you’ll get created/modified times. then just grab the doc content with docs API after. it’s a bit more work but gets you what ya need!
From my experience working with the Google Docs API, the @date field isn’t directly accessible through the standard documents.get method. However, there’s a workaround that might suit your needs. You can use the Drive API in conjunction with the Docs API to retrieve this information. First, make a call to the Drive API’s files.get endpoint with your documentId. This will return metadata including creation and modification dates. Then, use the Docs API to fetch the document content as you’re currently doing. While it requires an additional API call, this approach provides a comprehensive solution to access both the document content and its associated date information.