API column issues

Hi everyone,

I’m currently working on an API integration with Glide and Google Apps Script. Specifically, I’m trying to create an API that submits a call to a Google Script for chess move validation. While I’ve done a lot of troubleshooting, including using guidance from GPT, I keep getting errors when I use the API in Glide’s API column.

I’ve confirmed that the Google Script itself is functioning as expected. When I construct the API call using tools outside Glide, it responds correctly. However, when I use it within Glide, it consistently fails.

Here is the test URL that works for me when tested directly:

Working Test URL: https://script.googleusercontent.com/macros/echo?user_content_key=AehSKLgczdTFP2icwbfOBstFjkndIP5DSLvIXr83LxUcSKsQnC0oNDD5B2pMOj1qWZevSFh_zI7PX59_YbV1ws996Mz3Hcrjv_4JESHUXHKkXUEgEnycNt-GI_H3zJlzRblQGZOukwzr22-FZgvqBss5Rl4OieSD3YfnVeM7M4TzuhqaGQiYRSUUXXrPQhXqcOty1a1oFLWgc0IrzxIxSVZrg6R09hEwMIE-6emy97qFw0rqB6ACY-hlBtEDhghIw-Oq2_8zHXXgG9qINZetuN5KwfNWj8K0nE9nWlmZveu6H0ljGX8QcVIqlp2eKJJCvINwsK9aVnPSjEKy2FfYD-IX6160Y5gahOUIz_vhiMEPVRK8bUaSNIng1Mx6CNeKTIeAXpOkL4NmIzPsHd2rQrs&lib=MKmZATJM5XVaPMAivzrWOsQ0Aom0n77cC

The test URL works perfectly when I pass the parameters like fen=rnbqkbnr/pppppppp/8/8/8/3P4/PPP1PPPP/RNBQKBNR%20b%20KQkq%20-%200%201&move=d2d3. However, when I try using the API column in Glide, I encounter errors.

Is it possible that the API in Glide is unreliable, or might I be missing something in the setup? Any assistance or insights would be greatly appreciated.

I have tried Get and the Post with query fields all set correctly to send the variable fen and move… as you can see the test URL confirms the Google Script is working, the issue must be with Glide.

Thank you in advance!
Simon.

1 Like

Did you set the header “Content-Type” property in the Call API column?

I did not enter anything in the header… thanks for the tip. I can use GPT to ask what this might mean I guess unless there are 1 or 2 things for you to suggest

I really suggest you feeding the header :slight_smile:

1 Like

I followed this advice:

The response about setting the “Content-Type” header is a helpful tip. It sounds like the issue might be related to how the request is being sent to Glide, and the header is crucial for the request to be processed correctly.

You can add the “Content-Type” header as follows in Glide’s API column:

  1. Open your Glide app.
  2. Go to the API column settings.
  3. Add the header Content-Type and set it to application/x-www-form-urlencoded or application/json (depending on what the Google script expects).

But it did not fix the issue.

You are getting a 302 redirect status. That means the Endpoint you sre trying to reach is redirecting on another URL. Try with the redirected URL directly.

Have you deployed the latest version of your code?

Well actually, @comm_support_agent this must not be considered failure…

I did deploy and as me with Anyone can access…. I have had versions that have worked but needed updating with new code. So I know it can work…. Just that any version I create now works outside of Glide but not when called via my Glide app.

The link I’m using is not the latest version, maybe it’s trying to redirect to a newer version…. I will try to delete all old versions and deploy the latest only.

I have done this before. The way it works for me is to send a POST request with a JSON body.

Here is what the Call API node setup looks like:

And the JSON payload:

One thing I do know is if you make any edits to the Apps Script, the endpoint breaks and must be redeployed. You can do this without changing the URL by selecting Manage Deployments:

Then select the previous deployment and create a new version.

2 Likes

Thanks… I noticed you didn’t use any Header info, e.g. to confirm you are sending a json. Is the header info optional typically?

I’m not sure to be honest. My guess is that Content-Type is application/json by default, so in this case it’s not necessary to explicitly provide it.

1 Like

So I deployed a completely new version. It is working since it has a doget and a dopost function that works… you can test it with this URL directly in a web browser:

https://script.google.com/macros/s/AKfycbwMIY5rhp-6-HUdrKSSAx0TZDpwpTEOc_0hcpNqqXnudHRwOzMtZKZhUrP8wgymIG3CYw/exec?fen=rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR%20w%20KQkq%20-%200%201&move=e2e4

It functions perfectly outside of Glide. but when I try in Glide I get error 302. So frustrating. I have triple checked all the workflow parameters.

I get a 400 in a browser.

Interesting. Thanks for testing the link. I did set the deployment to as Me but for Anyone. I’m a bit stumped.

Also on my phone I get this screen

but other people in my family also get the error message. I guess the access to the web app is not unrestricted despite attempting to define Anyone in the deployment step…

Yeah, it does seem like a permissions issue.

I thought this was correct…

Execute as Me
Access: Anyone

2 Likes