Pass a list or json inside args

variables
piston

#1

I would like to trigger a piston from url to update some global variable. Its working fine one at the time but I would like to pass a list inside the url. Lets say : https://key/pistonid&name=test&value=1
this run well but I would like to be able to use something like that: https://key/pistonid&name=test,test2,test3&value=1,2,3
So using name[1] to extract the args, like with json. For now I m not able to do it act like json nor list. The only way that could work is to use a kind of separator between each and use complicated formula with search function to extract each…

Thanks!


#2

So do you have piston with list/array variables?

What does it pass if you send the array variables?

An example of what you have done would help.


#3

no, its not a piston that send something… I have a google script or alexa skills…etc that send web request to trigger the piston! Like, if you go in your piston and copy the link here image you can trigger the piston from any web service…I just add arguments that can be pass through that! The thing is that it must be like: value=somthing&value2=somenthing&value3=somthing… and when you read it from the piston, it must be like: $args.value, $args.value2, $args.value3…
But if I would like to use array instead like $args[2] and it sounds not possible. I would like to pass multiple value to update multiple variable in the same call but with single line of code… I can update the variable by its name but need to loop through the data (setVariable("@"+$args.value1,something)). Hope this will help! thanks!


#4

yes, but you can create a test program with a piston to send an array variable.

if it works, you know what the parameters look like. If it does not you have something that others can look at for either piston or webcore bugs.


#5

The code looks like it converts things to a Map (converted to json) of

[variable:value, variable1:value1, variable2:value2] (for execute piston).

So it seems to be expecting in data; a json encoded map for args

In webcore pistons, when calling another piston, you can pass a list of variable, and webcore does the above when calling the other piston


#6

yes, but in my case I trigger the url from google sheet, or web browser… so I cannot extract value in json format… I try to find a way like : name=[value1,value2,value3]&value=[value1,value2,value3] but its not working…


#7

You may have to do an indirection

  • you call a piston with your two variable format
  • that piston changes / interprets it

I still think you should use two pistons to see what webCoRE will accept, then deal with your external part.


#8

@E_Sch I thought I remember being able to log contents of $args in ST, I can’t seem to do that in HE (I get a null), is it because the access_token is included in the piston url?


#9

You should see $args in the IDE piston view under variables

after the piston has recently run


#10

Ah, ok, I didn’t think to look there as I was expecting an output from the Log task.