I need a DELAY method & setTimeout() is undefined (not found Window)

Yes @Bill.French I’ve checked and rechecked … same code! I can’t recreate the state of my system the other night when it was failing and I chased a rabbit down the wrong trail… but I swear it was not working… now it could be one of many reasons (maybe none the timeout method) cause I’m a newbie with embedding JS like this.

But now that it’s working I’m continuing my attempt to get stock quotes via 3rd party (Alpha Vantage http://alphavantage.co) - I’d like to know what interfaces I’d need to support to make my code a first rate Airtable block. (any info?)

Simple answer - Script Block is an infant, not even a toddler yet. Surprisingly, it runs very well despite it being only a few weeks old.

1 Like

Thanks for the info. I don’t use an IDE.

I have seen wavy red underlines in other contexts for years (Word documents), and they usually mean that the grammar checker thinks the section has a grammar problem. Sometimes there really is a grammar problem, and sometimes there isn’t. When I know the grammar is correct, I ignore the wavy red underlines.

My code editor does not have a grammar checker, but it does color-code text according to a selected grammar, which helps in discovering some grammar problems.

In the Airtable scripting block, I assumed that the wavy red underlines were also a grammar/vocabulary checker. I find that Airtable editor’s grammar/vocabulary checker is so overzealous that it gets in my way. I do use it to check to make sure the grammar and vocabulary is correct, but I also feel free to ignore its suggestions.

I have not seen wavy red underlines directly indicating that a particular feature is unsupported. Rather I take it to simply mean that the grammar checker does not understand the section, which may or may not mean that the features lack support.

I’ve been very happy with Scripting block, and I’ve gotten a lot of enjoyment out of it. I’m not surprised at how well it runs–I expected that level of quality from Airtable.

LOL! I believe you. This is software.

Well, you need URLFetch() to pull that off, but “first rate” is a subjective question.

Yes the Scripting Block does a really good job for being such a new feature. I AM AMAZED. I worked with it for hours and never had any issue. For a web app - this is unheard of reliability - not seen since Netware was turned off. Someone knows how to write some great code that recovers all it’s memory well.

How are you calling the other API? One of the APIs I use doesn’t allow you to pass your key through the URL and when I try to install https, it doesn’t seem to work.

In the script (JavaScript code):

let info = await fetch(https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=${symbol}&apikey=${API_KEY});

But the format of the URL is API specific - this is for Alpha Ventures. You should read their docs/examples or call them.

1 Like

Thanks for the info. This company doesn’t actually have API documentation which makes trying to find what to pass very frustrating. Their example shows “api-key” but it only works when using curl… I’ve reached out to their team and it seems like their knowledge of how it works is as good as their non-existent documentation.

Paste the CURL example here and I’ll bet we can transform the requirements into Airtable speak.

Thanks guys!

Here it is:
curl --header “api-key: [apikeytxt]” -X GET "https://api-hazards.atcouncil.org/public/v1/wind.json?lat=[lat variable]&lng=[long variable]

Something like:

let url = '"https://api-hazards.atcouncil.org/public/v1/wind.json?lat=[lat variable]&lng=[long variable]';
let getOptions = {
    method: "get",
    headers: {
        'api-key' : 'apiKeyHere',
        'Accept'  : 'application/json',
    }
}
let postResults = await fetch(url, getOptions);
1 Like

That worked! Thank you, sir!

With how much our business uses random APIs like this, I plan on sharing this and another script we recently created in the forum once they’re up and running.