dvargas92495 / SmartBlocks

Useful examples from developer community for Roam42 SmartBlocks
147 stars 7 forks source link

Stoic Example #2 - another approach to async calls and roam42 GET variables with JavaScript #77

Open TfTHacker opened 3 years ago

TfTHacker commented 3 years ago

✂️ Copy of your #42SmartBlock from Roam

📋 Describe the SmartBlock

Copies a quote to your graph from 'https://stoic-quotes.com/api/quote. It also demonstrates how to use the GET command and JavaScript together to pass variables around

📷 Screenshot of your #42SmartBlock workflow/template from Roam

💡 Additional Info

The quotes API has to be routed through a gateway due to CORS issues. Sometimes this is very slow and may cause the SmartBlock to timeout. This is not an issue with SmartBlocks, but rather the nature of remote web service calls.

JasperGeh commented 3 years ago

Something is broken with the URL, I think. I get a net::ERR_NAME_NOT_RESOLVED error in the console and manually opening https://cors-anywhere.herokuapp.com/https://stoic-quotes.com/api/quote also results in a 404. https://stoic-quotes.com/api/quote itself does work and returns a JSON with the quote and author but if I delete the cors-anywhere part of the URL and try the SB just with the stoic-quote.com URL, I get a net::ERR_FAILED error.