Re: calling an api from a stack?

2018-06-15 Thread Mike Bonner via use-livecode
Thanks for the tip, and clarification. On Fri, Jun 15, 2018 at 3:34 PM Bob Sneidar via use-livecode < use-livecode@lists.runrev.com> wrote: > Yes, but you found more utility than I was thinking of. My thing is that > when tracing/debugging, I need to see what a function returns, and I can >

Re: calling an api from a stack?

2018-06-15 Thread Bob Sneidar via use-livecode
Yes, but you found more utility than I was thinking of. My thing is that when tracing/debugging, I need to see what a function returns, and I can only do that if I put the returned value or it or the result into a variable of some sort. Bob S > On Jun 15, 2018, at 14:28 , Mike Bonner via

Re: calling an api from a stack?

2018-06-15 Thread Mike Bonner via use-livecode
If you mean using merge inside the function, I guess one could do the merge beforehand and pass it in as a parameter, or alternatively do the merge in the function and return the generated url string as part of the returned value. IE change it like so.. function translate pText,pLang put

Re: calling an api from a stack?

2018-06-15 Thread Bob Sneidar via use-livecode
Again, this is why I don't like to nest functions. You cannot tell what the function returned without pulling it apart. Bob S > On Jun 15, 2018, at 10:40 , Mike Bonner via use-livecode > wrote: > > jsontoarray returns an array, you'll have to dig through the array to find > where pieces of

Re: calling an api from a stack?

2018-06-15 Thread Mike Bonner via use-livecode
jsontoarray returns an array, you'll have to dig through the array to find where pieces of information reside, but it pretty straightforward after you poke around. For example.. If you instead do this.. put jsontoarray(tResult) into tArray you have an array variable named tArray. If you-- put

Re: calling an api from a stack?

2018-06-15 Thread Eric A. Engle via use-livecode
This works, sort of: put URL "https://translate.yandex.net/api/v1.5/tr.json/translate?key=trnsl.1.1.20180527T091305Z.7f33f9fb3f66f0bb.d573f1d9a6336a981504916600c45f49255938b3=hello%20world=en-de; into tResult put tResult into card field 1 --put JsonImport(tResult) into tResults --put

Re: calling an api from a stack?

2018-06-15 Thread Mike Bonner via use-livecode
/* A quick and dirty example of using yandex translator Fill in your key then use the 2 functions to try things out. Put this in your card or stack script, then call the desired function passing in the required parameters. */ constant kKey="put your key here" constant kGetTransURL="

calling an api from a stack?

2018-06-15 Thread Eric A. Engle via use-livecode
I am trying to make a call to the yandex translate api for a stack i am working on. i could do this pretty handily in HTML but I want to do it in livecode. I tried working with this but using yandex api instead of google