OK, I have a very FREAKY thing to report in this category...
I was playing around with webhooks, trying to get them to work as in here:
So I created a webhook like this using deviceid
like this:
JimBrowerMacbookPro:desktop browerjames$ particle webhook create sunrise_sunset.json
Using settings from the file sunrise_sunset.json
Sending webhook request { uri: 'https://api.particle.io/v1/webhooks',
method: 'POST',
json: true,
form:
{ event: 'sun_time',
url: 'http://api.wunderground.com/api/redacted/astronomy/q/{{myState}}/{{myCity}}.json',
requestType: 'POST',
headers: null,
query: null,
responseTemplate: '{{#sun_phase}}{{sunrise.hour}}~{{sunrise.minute}}~{{sunset.hour}}~{{sunset.minute}}~{{/sun_phase}}',
json: null,
auth: null,
deviceid: '{{SPARK_CORE_ID}}',
mydevices: true,
access_token: 'redacted' } }
and it didn't return at all... then I modified it back...
JimBrowerMacbookPro:desktop browerjames$ particle webhook create sunrise_sunset.json
Using settings from the file sunrise_sunset.json
Sending webhook request { uri: 'https://api.particle.io/v1/webhooks',
method: 'POST',
json: true,
form:
{ event: 'sun_time',
url: 'http://api.wunderground.com/api/redacted/astronomy/q/{{myState}}/{{myCity}}.json',
requestType: 'POST',
headers: null,
query: null,
responseTemplate: '{{#sun_phase}}{{sunrise.hour}}~{{sunrise.minute}}~{{sunset.hour}}~{{sunset.minute}}~{{/sun_phase}}',
json: null,
auth: null,
coreid: '{{SPARK_CORE_ID}}',
mydevices: true,
deviceid: undefined,
access_token: 'redacted' } }
Successfully created webhook with ID redacted
but the file does not have deviceid
in it!!!!
My webhook file:
{
"event": "sun_time",
"url": "http://api.wunderground.com/api/6b82bd24e2449d28/astronomy/q/{{myState}}/{{myCity}}.json",
"requestType": "POST",
"headers": null,
"query": null,
"responseTemplate": "{{#sun_phase}}{{sunrise.hour}}~{{sunrise.minute}}~{{sunset.hour}}~{{sunset.minute}}~{{/sun_phase}}",
"json": null,
"auth": null,
"coreid": "{{SPARK_CORE_ID}}",
"mydevices": true
}
well, lo and behold... it now returns 100% of the time!?!?!? yes, that is 100%, not one error after one hour of sending every 30 seconds.... What?
Just look at this:
{"name":"sun_time","data":"{ "myCity": "Weston", "myState": "FL" }","ttl":"60","published_at":"2015-08-29T19:31:12.809Z","coreid":"2f0023000547343233323032"}
{"name":"hook-response/sun_time/0","data":""7~00~19~44~"","ttl":"60","published_at":"2015-08-29T19:31:13.018Z","coreid":"undefined"}
{"name":"sun_time","data":"{ "myCity": "Weston", "myState": "FL" }","ttl":"60","published_at":"2015-08-29T19:31:42.808Z","coreid":"2f0023000547343233323032"}
{"name":"hook-response/sun_time/0","data":""7~00~19~44~"","ttl":"60","published_at":"2015-08-29T19:31:43.084Z","coreid":"undefined"}
{"name":"sun_time","data":"{ "myCity": "Weston", "myState": "FL" }","ttl":"60","published_at":"2015-08-29T19:32:12.807Z","coreid":"2f0023000547343233323032"}
{"name":"hook-response/sun_time/0","data":""7~00~19~44~"","ttl":"60","published_at":"2015-08-29T19:32:13.377Z","coreid":"undefined"}
{"name":"sun_time","data":"{ "myCity": "Weston", "myState": "FL" }","ttl":"60","published_at":"2015-08-29T19:32:42.810Z","coreid":"2f0023000547343233323032"}
{"name":"hook-response/sun_time/0","data":""7~00~19~44~"","ttl":"60","published_at":"2015-08-29T19:32:43.424Z","coreid":"undefined"}
{"name":"sun_time","data":"{ "myCity": "Weston", "myState": "FL" }","ttl":"60","published_at":"2015-08-29T19:33:12.809Z","coreid":"2f0023000547343233323032"}
{"name":"hook-response/sun_time/0","data":""7~00~19~44~"","ttl":"60","published_at":"2015-08-29T19:33:13.334Z","coreid":"undefined"}
{"name":"sun_time","data":"{ "myCity": "Weston", "myState": "FL" }","ttl":"60","published_at":"2015-08-29T19:33:42.811Z","coreid":"2f0023000547343233323032"}
{"name":"hook-response/sun_time/0","data":""7~00~19~44~"","ttl":"60","published_at":"2015-08-29T19:33:43.190Z","coreid":"undefined"}
{"name":"sun_time","data":"{ "myCity": "Weston", "myState": "FL" }","ttl":"60","published_at":"2015-08-29T19:34:12.809Z","coreid":"2f0023000547343233323032"}
{"name":"hook-response/sun_time/0","data":""7~00~19~44~"","ttl":"60","published_at":"2015-08-29T19:34:13.585Z","coreid":"undefined"}
{"name":"sun_time","data":"{ "myCity": "Weston", "myState": "FL" }","ttl":"60","published_at":"2015-08-29T19:34:42.813Z","coreid":"2f0023000547343233323032"}
{"name":"hook-response/sun_time/0","data":""7~00~19~44~"","ttl":"60","published_at":"2015-08-29T19:34:43.597Z","coreid":"undefined"}
{"name":"sun_time","data":"{ "myCity": "Weston", "myState": "FL" }","ttl":"60","published_at":"2015-08-29T19:35:12.811Z","coreid":"2f0023000547343233323032"}
{"name":"hook-response/sun_time/0","data":""7~00~19~44~"","ttl":"60","published_at":"2015-08-29T19:35:13.319Z","coreid":"undefined"}
{"name":"sun_time","data":"{ "myCity": "Weston", "myState": "FL" }","ttl":"60","published_at":"2015-08-29T19:35:42.815Z","coreid":"2f0023000547343233323032"}
{"name":"hook-response/sun_time/0","data":""7~00~19~44~"","ttl":"60","published_at":"2015-08-29T19:35:43.074Z","coreid":"undefined"}
{"name":"sun_time","data":"{ "myCity": "Weston", "myState": "FL" }","ttl":"60","published_at":"2015-08-29T19:36:12.814Z","coreid":"2f0023000547343233323032"}
{"name":"hook-response/sun_time/0","data":""7~00~19~44~"","ttl":"60","published_at":"2015-08-29T19:36:13.065Z","coreid":"undefined"}
{"name":"sun_time","data":"{ "myCity": "Weston", "myState": "FL" }","ttl":"60","published_at":"2015-08-29T19:36:42.814Z","coreid":"2f0023000547343233323032"}
{"name":"hook-response/sun_time/0","data":""7~00~19~44~"","ttl":"60","published_at":"2015-08-29T19:36:43.617Z","coreid":"undefined"}
{"name":"sun_time","data":"{ "myCity": "Weston", "myState": "FL" }","ttl":"60","published_at":"2015-08-29T19:37:12.813Z","coreid":"2f0023000547343233323032"}
{"name":"hook-response/sun_time/0","data":""7~00~19~44~"","ttl":"60","published_at":"2015-08-29T19:37:13.611Z","coreid":"undefined"}
{"name":"sun_time","data":"{ "myCity": "Weston", "myState": "FL" }","ttl":"60","published_at":"2015-08-29T19:37:42.815Z","coreid":"2f0023000547343233323032"}
{"name":"hook-response/sun_time/0","data":""7~00~19~44~"","ttl":"60","published_at":"2015-08-29T19:37:43.385Z","coreid":"undefined"}
Ok I am officially befuddled.... @Dave ?
it still does not return how I want, but 100% reliability... unprecedented. I wonder if the examples are not missing a key field?
WOW interesting...