How is a fetch of a cURL used?

Greetings to the whole community. I have a question to ask: until now, when using a query of a json file, I had a canonical URL. This time, however, I get a cURL that works fine, but when converted to a URL, it no longer works.
The cURL is as follows: curl -X GET “” -H “accept: application/json” -H “x-api-version: 1.0” -H “X-DANEA-API-KEY: 7011819a-fb58-4ede-8cec-xxxxxxx”
The converted url, on the other hand, which I tried to use, is as follows:
I’m starting to get a bit desperate :slight_smile:
I could convert it to Javascript, but then I wouldn’t know how to use it. There is surely someone better versed in this kind of situation than I am. Thanks!


Your cURL command should look like…

curl -X GET ""   
-H "accept: application/json"    
-H "x-api-version: 1.0"    
-H "X-DANEA-API-KEY: 7011819a-fb58-4ede-8cec-xxxxxxx"  

If we use a Javascript code, this should be:

const url = '';

const response = await fetch(url, {
    headers: {
        'accept': 'application/json',
        'x-api-version': '1.0',
        'X-DANEA-API-KEY': '7011819a-fb58-4ede-8cec-xxxxxxx',

const json = await response.text();  // or response.json();
return json 

Try this code on your Page using a valid API key and let me know the results please. The web site is working fine btw?



Thank you @gvalero for your reply. The Javascript code does not give me an error. The keys I have exposed are clearly fictitious. Once they are entered into the column correctly, the system does a check and expects more data, which are p1, p2…
At this point I would like to understand what to enter. I thank in advance anyone who would like to engage in this arduous explanation :slight_smile:

What do you mean by this? The javascript column allows for 3 parameters. Those 3 parameters are always there. You can do anything you want with them if your code requires parameters to pass in data from other columns. However, you are not required to use them if you don’t need them.


Hola de nuevo!

Just replace/use a valid API key in this line and let us know results you get.

'X-DANEA-API-KEY': '7011819a-fb58-4ede-8cec-xxxxxxx',

p1 and p2 are parameters but in this specific case, you don’t need to use them so far

1 Like

Unfortunately, it gives me an error:
Function Error
TypeError: Failed to fetch
I have entered the correct API key and no parameters.
The cURL works.

Uuummm… :roll_eyes:

Don’t you have a CORS problem similar to the one you had a while back here:?

I don’t think so. If I try it directly in a windows CMD shell, it works. I instantly display a wonderful JSON.

In simple terms, CORS means you are trying to access a URL via another URL. That’s different from directly accessing the destination URL directly as you are with the CMD shell. It’s a browser security feature to help prevent a website from stealing information from another website. Some websites allow CORS and some don’t.

A server backend can access data protected by CORS whereas a website cannot indirectly access that same data. Since a javascript column runs directly within a Glide App (as a middle man between the end user and the destination URL, and not directly on glide servers), then it is subject to the CORS policy.


It could be. So there is no way to use this API?

If you have a CORS problem, your plan B is to use a CORS proxy to avoid this problem, but you should pay attention to security:


Greetings to all. I managed to solve this long-standing problem by getting help from a Google Sheet plugin I was already using successfully for weather: mixedanalytics API connector.
With this fantastic help, I managed to import the cURL and after very little work on the data to be extracted, by the way also in a visual way without any code, boom… it extracted all the data I needed in the Google sheet. I hope it will be useful to other friends in this community as well.