Multiple fields w/ Webhook (virtualWrite array) possible?

Howdy! Getting Webhook to work with data.sparkfun.com just fine. Thanks for the great widget.

Is there a way to send multiple fields with one Webhook widget?

My project is sending 3 strings to sf, something like https://data.sparkfun.com/input/pubKey?private_key=privKey&temp1=temp1&temp2=temp2&temp3=temp3.

I’ve tested the above with https://data.sparkfun.com/input/pubKey?private_key=privKey&temps=/pin/ in the Webhook widget, and Blynk.virtualWrite(66, temp1, temp2, temp3); in the code, and the array works but of course with just the three temperatures above mashed together in one string. Is there some way of unraveling that array?

Thanks!

Hello. Hm… Interesting case. What would you expect from

Blynk.virtualWrite(66, temp1, temp2, temp3);

is

https://data.sparkfun.com/input/pubKey?private_key=privKey&temps=/pin/

fine like this :

https://data.sparkfun.com/input/pubKey?private_key=privKey&temps=temp1&temps=temp2&temps=temp3

?

Gah! I didn’t even think of just doing this in code:

Blynk.virtualWrite(66, String("temp1=") + temp1 + "&temp2=" + temp2 + "&temp3=" + temp3);

then the app URL is just https://data.sparkfun.com/input/pubKey?private_key=privKey&/pin/.

Worked a treat! Suppose I just needed to talk it out! :slight_smile: Thank you sir.

Nice workaround. However Blynk goal is to simplify such things… So in next update we will introduce something like

&temp1=/pin[0]/&temp2=/pin[1]/&temp3=/pin[2]/

1 Like

@structure7 implemented and deployed.

1 Like