I have done my homework, spent days reading all the threads and tutorials but no luck. My knowledge in json and web related coding is limited but this seems like something people do with dataloggers all the time. Here’s what I have so far:
Setting up the webhook is confusing. This is the point where I really need a hand. I have had some luck getting the connection to initialstate but always received a bad request error 400 complaining no events.
Not sure about your data target, but the JSON doesn’t seem to fit the usual format.
Usually you’d use mytemp as the key designator on the left side of the colon and 12.5 on the right side as value. You wouldn’t separate the key and the value into two independent key/value pairs using key and value as the respective keys.
I read the initialstate streaming API instructions and got my idea from there. Here's a couple screenshots incase the link doesn't work.
I suppose my biggest frustration has to do with the particle webhook creator. I can't seem to understand how and where the data in my code goes in the so called webhook. SO when you say ...
... I don't know what to do. Sorry! Your code suggestion replacing sprintf results in
…but still doesn’t match the format suggested at initialstate:
And as I mentioned before: in particle console-integrations its the webhook builder fields I don’t know how to fill properly. I know I need to set initialstate url, bucket key and accesskey somewhere so the argon data gets sent to the right place. But there are so many alternatives and believe me I have tried them all
The format I provided adheres to the UNIX epoch format with full seconds resolution. I don't think you'll get much better realtime resolution from the Argon.
I now see that this API actually expects you to split your key/value data into two key/value pairs (which is odd IMO).
However, in that case you can try this
Published data looks really good in console, thanks.
Had to edit...
char outgoing[200];
...though. I then changed request format to custom body and made the changes as suggested. I put the access and bucket keys first in the url field and then in the html header field. However it seems as if there is still no data being posted.
Initialstate stream is empty (usually full of data)
I suppose it would be easy to test if somebody had a particle device hooked up, uploaded the code, made a webhook and tested it against postbin service.
Interested in this too. But first I feel we should make the json alternative work first, I mean I can't be the first one to struggle with this. BTW thanks so far for the help!
You should not try to validate the “PRETTY” version of the JSON string but “RAW”.
Then you will see the same JSON (without the line breaks and indentation) as the one that validates in your last post
I tested with requestbin and the data arrived as expected.
So I guess your issue either lies in the documentation of their expected format or the way how you provide the access creds.
But I cannot test that without creating an Initial State Streaming account.
Well that's good news because then there's more hope getting the data to initialstate too. I´ll have to figure out why I don't get the data to postbin. I´ll get back soon.
I have now managed to target their mock-up server and got the job running
There were some minor adoptions to the JSON format and the webhook definition required
That’s it, thank you so much @ScruffR . A couple of ending thoughts.
Postbin gave me this result…
…which has a novice like me thinking something is wrong whereas Requestbin gave me this
In Particle console pretty looks like this…
…whereas in Requestbin pretty looks like this…
…seems like too small a detail to even mention here but I think in a world where one character can fail everything its actually confusing.
Yep, triple handlebars!
I have enjoyed reading the forums of this community for about 2 years now but only 2 days ago I registered in the community and this was my first post. What a pleasure to be helped by the legendary @ScruffR. I really leared a lot!
“Pretty” is not a standardised format
The console PRETTY view doesn’t profess to be the same as requestbin’s “PRETTY” version, but when you look at requestbin’s “STRUCTURED” representation you will find the similarities.
If you want to see the actual data you always should go for raw
BTW, postbin’s [object Object] result correctly indicated that there actually was some data but didn’t know or care how to unwrap it.
Hah, one day I might laugh at myself for thinking that, but right now, that's just the kind of thing I might spend hours trying to understand and read about. Anyway I'm just really glad it all worked out!