I am trying to create a webhook that incorporates some way to link a particle device ID to another number to be used by the targeted webservice (in this example PVOutput).
Pvoutput wants you to add a systemID as a header to your query. Now I could probably program every Electron with its SystemID. But I thought the solution given here would be much nicer. I was wondering if it would be possible to use the webhook JSON to convert the Particle Device ID to a systemid for pvoutput. So we add an list of deviceids : systemids and use the moustache variable {{PARTICLE_DEVICE_ID}} to index the array. But this does not seem to be working.
Anybody got any thoughts on this issue? Another way to resolve this? Let’s assume that creating a webhook for every Electron is not possible, just as it is not possible to program the systemid into every Electron.
{
"event": "pvLiveData",
"url": "http://pvoutput.org/service/r2/addstatus.jsp",
"mydevices": true,
"requestType": "POST",
"auth": null,
"noDefaults":true,
"ids" :
{
"00000000000000000000" : "00000",
"00000000000000000001" : "11111",
"00000000000000000002" : "22222",
"00000000000000000003" : "33333",
},
"headers":
{
"X-Pvoutput-SystemId": "{{ids.{{PARTICLE_DEVICE_ID}}}}",
"X-Pvoutput-Apikey": "AAAAAAAAAA"
},
"rejectUnauthorized":false,
"query": {
"d": "{{d}}",
"t": "{{t}}",
"v2": "{{v2}}",
"v5": "{{v5}}"
}
}