Fetch JSON Column

Why is the Fetch JSON column not appearing?

Screenshot 2024-04-08 at 9.55.36 am

This was deprecated quite some time ago. You should use Call API instead. If you don’t have a plan that supports Call API, then you could probably use a JavaScript column.

How can you use the Javascript column ?

Something like the following:

const response = await fetch(p1);
const data = await response.text();

Where p1 is the URL that returns the JSON.

Doesn’t work for me. I tried other codes on this forum too.

Just that on it’s own won’t work. That was just to get you started. You obviously need to return something. Can you share with me the URL of the JSON you’re wanting to fetch?

I was trying the Geoapify API. URL: https://api.geoapify.com/v1/geocode/reverse?lat=51.21709661403662&lon=6.7782883744862374&apiKey=12345678

These aren’t my real coordinates it’s the example url. Also I replaced my real API key with 12345678 for this post, but I used the URL with my real key instead

Okay, so here is an example using a random public API (https://meowfacts.herokuapp.com/)

const response = await fetch(p1);
const data = await response.text();
return data;

Just be aware that this method is insecure, so if you are including API keys then you are risking that they could leak.

2 Likes

Thanks this works! But how do you get a specific part of it?

For example if we use the one you used and the result is “{“data”:[“The ancestor of all domestic cats is the African Wild Cat which still exists today.”]}”, how do we get the “data” bit so that the result is just “The ancestor of all domestic cats is the African Wild Cat which still exists today.” and not the rest?

Use the Query JSON column:

1 Like

Thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.