Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Google docs as a data endpoint to get JSON

I've been successfully using this URL to pull data from Google Sheets in JSON:

https://spreadsheets.google.com/feeds/cells/<SHEETS_ID>/1/public/full?alt=json

I want to get the JSON for a Google Docs document now. What would the URL be to do that?

I know I can use the GET API, but I'm trying to do this using simple AJAX and no OAuth (the file is public)

like image 341
Bill Ferster Avatar asked Jan 19 '20 12:01

Bill Ferster


Video Answer


1 Answers

Answer:

While the Google Spreadsheets Data API that hosts the https://spreadsheets.google.com/feeds/cells/<SHEETS_ID>/1/public/full?alt=json endpoint is still live, the Google Docs one is not and obtaining a Doc in JSON format in this way is no longer possible.

More Information:

The endpoint you are referencing to obtain Sheets data as a JSON structure is part of the Google Data APIs and is one of Google's older APIs - most of which have been replaced with newer APIs. The Spreadsheets one, as you can see here, is still live, where there is an interactive example explaining how to form this URL.

As you can see in the GData API Directory documentation however, the Google Documents List Data API has been shut down and replaced by the Google Drive API. Unfortunately, this means that the method you are looking for has been deprecated and so using either the Drive or Docs APIs now need to be used.

References:

  • Simple example of retrieving JSON feeds from Spreadsheets Data API
  • Google Data APIs - GData API Directory
  • Google Drive API
like image 100
I hope this is helpful to you Avatar answered Sep 28 '22 09:09

I hope this is helpful to you