🆕 Call API: call any API securely and return data back to your app instantly

thank you!

11 Likes

This is awesome!

When you say results are cached is that referring to the computed column version?

If so, how long until the cache is refreshed to get new data?

My use case example:

  1. Action to POST a customer record.
  2. Action to DELETE a customer record.
  3. Handle JSON returns for various in-app purposes.
  4. Computed column GET all customer records.

Step 4 isn’t GETting the latest records.

What is really cool, and for some reason I didn’t expect it, is that I can create a Glide table with only 1 row and a bunch of user-specific columns, and return API calls to the user-specific columns! This is great!

You can force a cache update by adding a dummy parameter to your URL with a value that changes at the interval you need the response updated. Every time the value changes, Glide will update the cached result.

3 Likes

This is very useful query for the users. They can easily backup their data by calling the API’s.

Hi,

I have a PRO plan and don’t have this option?

Tried with other columns as well. Enxperimental code is no where to be found.

It’s a pre-release feature. You can enable it from your Glide Dashboard in the Previews section at the top right.

2 Likes

This is epic @Robert_Petitto ! I’ve been trying to use the URL Construct + API Call to get a record from Airtable. I can get all the records, but cannot use the parameter function to filter the records. Nothing shows up. Any advice on airtable API in this instance? The API docs suggest filterByFormula but Glide isn’t resulting in an answer… I don’t have the airtable record id, I just want to search all records to find if a column has a specific barcode number.

Thank you for providing such detailed and easy to follow tutorials!

1 Like

I’m not terribly familiar with the AirTable API, but a quick search says you first need to encode the the formula. Not sure what type of encoding it needs.

1 Like

Thanks for your reply! I was trying to use the Glide column ‘Construct URL’ and for some reason the parameter wasn’t being read by Airtable in the ‘Call API’ Glide column.

But I got around it! Instead of using ‘Construct URL’ as in your example, I:

  1. Made the API URL I needed using the Airtable tool (link https://codepen.io/airtable/full/MeXqOg)
  2. Used a Glide ‘Template’ Column and pasted my airtable API URL, then replaced a dynamic element I needed with template values from Glide
  3. Used the ‘Template’ Column result as my “endpoint” value in ‘Call API’ Glide column.

And TADA! It worked, hooray
So all in all… Use a template column instead of the construct URL column when calling airtable API :slight_smile:

btw this is incredibly epic for saving sync time from airtable to Glide, I was previously using an airtable automation and waiting for Glide to re-sync the airtable data. That was taking around 30 seconds.

Instant result, very happy - looking forward to applying this further

3 Likes

Great to hear. The caveat of Construct URL is it will always encode your URL the correct way. However, some sites do have special formats for their URLs, so you’ll have to work around it to be able to get to the final result.

If anyone else is doing this and getting issues… My query was fetching “old” (cached?) data from airtable, even when a field had been changed. So I added a date onto the end using the ‘Format date’ Glide column from a date I had captured as part of my form. I just used this column + Glide • Format Date column + X from the reference: luxon - Immutable date wrapper

Some explanation is provided here… API GET call not retrieving updated table field da... - Airtable Community

What format are you sending your date in?
You just need to be aware that every time it changes, Glide will update its cached result, and that will count as an update. If you’re using something like YYYYMMDD that’s fine, as it will only change once a day. But if you’re using a full timestamp including seconds, then it will update every 10 seconds.

Ya— need to make sure I’m diligent about mentioning this in future API tutorials.

2 Likes

speaking of date formatting, a problem is occurring. I’m using the glide api with the glide call api to add multiple rows from one glide table to another glide table, within the same application. Almost everything goes well, just a small detail, the payment date column is in the dd/mm/yyyy format, but when going through the call and being added to the other table, it is being recorded as mm/dd/yyyy.

My use case is an application that generates a monthly payroll, where I need to confirm who has actually been paid, usually everyone on the payroll is paid, but if someone hasn’t been, then I delete the line before starting the payment action. inform payment that I just configured, with two api calls in the same action, the first one takes all my rows from the “payroll” table and writes it to the “made payments” table, the second deletes all my rows from the “payroll” table payment", getting ready for the next month.

Always send your dates in ISO8601 format. YYYY-MM-DD

1 Like

Can someone clarify what counts as or triggers an update when using the call API column? I seem to be racking up a lot of updates from that feature
Screenshot 2023-08-21 at 1.30.49 PM

I wonder if I’m using it in a way that is contributing to this. For example, I am appending a query to the URL that adds the unique item number of the row to the URL as a query to just return the json values for the item matching that item number. So If I have 300 rows each with a different query being called by the column, is that 300 updates each time it loads?

It would be at least 300 updates, and then the results would be cached. I don’t know how often the cache is refreshed.

1 Like

And more on this, every user that first load the app would trigger 300 updates, before it’s cached.

Edit: Further tests just now show that Darren’s suggestion that it is calculated server-side would be correct.

Is that actually true?
I was under the impression that these calls are made server side (which is how keys are kept secure), which should mean that results are (or at least could be) cached for all users :thinking:

1 Like

:thinking: You might be right. I was testing just now with 2 different devices on a table with 3 API calls and I don’t see the billing section increases my “Call API” count. I was wondering why Bob had such a great API call count in Slack like 2 weeks ago, I guess it was just a cache bust technique that refreshes too much, opposed to multiple users subjecting to different loads.

2 Likes