The ‘init’ fields seems to validate ok in the Particle webhook builder, but it does not like my ‘status’ field. Originally I was sending the ‘status’ field as a string i.e. “status”: “{{st}}” but I now want to send it in it’s true form: a floating point number - how do I do this?
Thanks
Joe
EDIT: As it stands, I get a ‘status’ field that looks like this:
The reason is that the JSON template itself must be valid JSON. That’s not, because {{st}} is not a valid number. Sure, it may be a valid number when the template is resolved, but the template itself is not valid JSON, and it must be.
A feature will be added to webhooks in the future to allow a mustache variable to specify a type. This would allow the type to be set as a float, int, boolean, JSON object, etc. as necessary.
This issue, and the inability to use an Array as a root JSON object for requests (ex: "json": [{}] ), are blocking the ability to push weather station data to OpenWeatherMap API 3.0 with Webhooks. Any idea if/when this feature will be available?
I have the same issue. I really would like to push true numbers from mustache variables. This is a feature that would really fuel the IoT abilities… The alternative seems to be a buggy https library on the photon POST’ing directly to firebase.
Ping to @rickkas7
You can send true numbers (integer and float), as well as arrays, using the body definition for a webhook. It’s described here in the “using the body definition” section.
@NielsClausen - I just completed a port of a TLS library that should connect to https. It is in raw form so you will have to send the header/body and parse the server response. Please see this post.
After reading and re-reading the docs and the tutorials, I am hoping I missed something. My current understanding is that we STILL can’t make product webhooks with the CLI and we STILL can’t use the body JSON to send numbers with the console. That means we can’t get a product to send numbers!?
Please tell me I am wrong.
This is holding up commercialization of a product and may, in fact, kill it.
Thanks!
I worked through your notes and script for the last few hours. I was having trouble formatting the JSON file correctly for use with your script. I finally figured out it doesn’t like spaces, tabs or new lines in the body along with escaped double quotes, so easy-to-read JSON formatting broke it. I fixed it by altering your script to remove the white space. FWIW, I couldn’t get JSON.minify or other methods to work with the escaped double quotes.