Hi Tony

HTTP GET is available under Node.js via the fetch command. The way to expose 
HTTP GET operations to wikitext in the browser would actually be via a message 
because the transfer needs to be initiated at a particular time -- remember 
that rendering widgets should not have side effects.

But the challenges are browser security: primarily CORS, which is a mechanism 
introduced by browsers specifically to prevent one website from grabbing data 
from another one; it is necessary to avoid certain kinds of cross site 
scripting attacks.

https://en.wikipedia.org/wiki/Cross-origin_resource_sharing

Secondarily, some browsers don't permit GET requests to be made from pages 
loaded from file: URIs.

There are workarounds (notably something called JSONP), but the cleanest 
solution is to use the client-server configuration and let the server do the 
HTTP requests.

There is a pending patch that makes it possible for wikitext in the browser to 
invoke commands on the server (including fetch):

https://github.com/Jermolene/TiddlyWiki5/tree/external-tasks

Best wishes

Jeremy.


--
Jeremy Ruston
jer...@jermolene.com
https://jermolene.com

> On 20 Feb 2019, at 09:35, TonyM <anthony.mus...@gmail.com> wrote:
> 
> Folks,
> 
> I have a 3rd party resource that provides me with some urls that returns some 
> values. If I place the URL in the Browser address bar I see the result.
> 
> eg
> {"thanks":"Thanks from all of us at filled.count.soap for using a what3words 
> API","crs":{"type":"link","properties":{"href":"http:\/\/spatialreference.org\/ref\/epsg\/4326\/ogcwkt\/","type":"ogcwkt"}},"words":"index.home.raft","bounds":{"southwest":{"lng":-0.203607,"lat":51.521238},"northeast":{"lng":-0.203564,"lat":51.521265}},"geometry":{"lng":-0.203586,"lat":51.521251},"language":"en","map":"https:\/\/w3w.co\/index.home.raft","status":{"reason":"OK","status":200}}
> 
> Is there a way, or could be there be a way for me to provide the URI and have 
> the result returned in a tiddler or "text reference" that I could then 
> interrogate?
> 
> I imagine it will need a trigger widget, and would likely be an action widget 
> but is there an existing way?
> 
> Would it be hard or dangerous to provide such? 
> 
> If this were so, For me I can build an API connection without learning 
> developer tricks right now (Which I will eventually).
> 
> It would also be nice if we could load anything at a URI into a tiddler. 
> >From a JSON, a Plugin Tiddler, the content of another wikis tiddler, or even 
> a post in another platform into a tiddler.
> 
> Regards
> Tony
> -- 
> You received this message because you are subscribed to the Google Groups 
> "TiddlyWikiDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to tiddlywikidev+unsubscr...@googlegroups.com.
> To post to this group, send email to tiddlywikidev@googlegroups.com.
> Visit this group at https://groups.google.com/group/tiddlywikidev.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywikidev/98603efa-4059-4367-88bf-2b2f5b476686%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywikidev@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/8EFDF08E-73F2-4570-A0CB-FB9770700D43%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to