I am attempting to use Particle Webhooks with Carriots, a data logging service. Carriots requires the user to POST data using an API key in the header (carriots.apikey). I have been unable to create the web hook with a period in the header name.
This is the JSON file that does not work:
{
"eventName": "webhookevent",
"url": "http://api.carriots.com/streams/",
"requestType": "POST",
"headers": {
"carriots.apikey": "xxxxxxxxxxx"
},
"json": {
"protocol":"v1",
"at":1355837673,
"device":"device@xxx",
"data": {
"temp":"21",
"hum":"58"
}
}
}
It gives the output:
Sending webhook request { uri: '/v1/webhooks',
method: 'POST',
json:
{ event: 'webhookevent',
url: 'http://api.carriots.com/streams/',
deviceid: undefined,
requestType: 'POST',
mydevices: true,
eventName: 'webhookevent',
headers: { 'carriots.apikey': 'xxxxxxxxxxx' },
json:
{ protocol: 'v1',
at: 1355837673,
device: 'device@xxx',
data: [Object] } },
headers: { Authorization: 'Bearer xxxxxxx' } }
Error {}
However, if I just delete the period in ‘carrots.apikey’,
{
"eventName": "webhookevent",
"url": "http://api.carriots.com/streams/",
"requestType": "POST",
"headers": {
"carriotsapikey": "xxxxxxxxxxx"
},
"json": {
"protocol":"v1",
"at":1355837673,
"device":"device@xxx",
"data": {
"temp":"21",
"hum":"58"
}
}
}
the web hook is accepted:
Sending webhook request { uri: '/v1/webhooks',
method: 'POST',
json:
{ event: 'webhookevent',
url: 'http://api.carriots.com/streams/',
deviceid: undefined,
requestType: 'POST',
mydevices: true,
eventName: 'webhookevent',
headers: { carriotsapikey: 'xxxxxxxxxxx' },
json:
{ protocol: 'v1',
at: 1355837673,
device: 'device@xxx',
data: [Object] } },
headers: { Authorization: 'Bearer xxxxxxx' } }
Successfully created webhook with ID xxxxxxxx
I tried encoding the period (i.e. carrots\u002eapikey), but I still got the same error. Any ideas on how to get webhooks to work with carriots.com?