This topic is locked

REST API and Google Sheets

10/20/2022 10:21:24 AM
PHPRunner General questions
R
rmac author

I'm using 10.8/ 39925 and having an issue trying to do a simple HTTP GET request to a Google spreadsheet. All I can get in the response is a 302 redirect error. Hitting the the same link with a browser returns JSON data as expected. Here's what I've done:

  1. setup a test spreadsheet with a few lines of sample data
  2. went to Apps Script and used the default example generally available online
  3. deployed the script as a web application using my Google login/ password as credentials
  4. copied the web app URL from the Deploy page
  5. setup a REST view using HTTP Basic authorization, added my Google login and pasted that URL into the connection
  6. hitting Run request consistently gets me this:

<HTML> <HEAD> <TITLE>Moved Temporarily</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1>Moved Temporarily</H1> The document has moved <A HREF="https://www.google.com/a/mrits.com/ServiceLogin?passive=1209600&continue=https%3A ...

I've tried a few times with different spreadsheets and always get the same results. I've tried the demo samples (soccer, HK Covid, etc) and they all work as expected. I suspect that the redirect has something to do with authentication, but that's just a guess. Have I missed a step somewhere?

I really want to get this working. We have several clients that use spreadsheets for job tracking and having API read/ write access to them from our database would be VERY helpful. (even though I'd need to upgrade to Enterprise to do that)
If anyone else has got this to work or have any suggestions, they would be appreciated.

TIA

Ray

admin 10/20/2022

Hard to tell what might be wrong, we never worked with this specific API. I guess someone needs to go through their documentation and see what kind of authentication is required. According to what I see they support API keys and OAuth. I guess HTTP Basic autorization won't work here. I works in the borwser because you are logged in to Google which is a totally different story.

Anyway, if you need help with this, you can contact support directly and we will help you configure it.

R
rmac author 10/21/2022

Thanks for the input. I thought this would be the easiest solution, but if it's an outlier in this case I'll move on to using one of the other methods and file a support request if I have issues with that.