How to create API calls to external sources?

Hola!

I will try to give you another way to solve your request:

Do you need to make a GET or POST request?
Unfortunately, the Fetch JSON plugin does not support POST requests but using a JS code you can do it depending on parameters you are using.

If you need a GET request, your JS code can be something like this:

var Response = await fetch('https://yesno.wtf/api')
const Result= await Response.json();
return Result.answer + "|" + Result.forced + "|" + Result.image

but pay attention to Thinh’s advice:

Using JavaScript to do it from the app is not an ideal way, since it might trigger the payload to send more times than you want it to.

The plan B to avoid the above problem is to create a button to fire the API call manually, otherwise, you will face this problem, a headache :rage:

Are you using a cURL command? If so, share the cURL command to evaluate how can it be converted to a JS code or better, use this online tool to convert it automatically.

Saludos!

2 Likes