Device ID JSON Path


#1

I made a Workflow that uses a webhook to obtain data from the Particle Cloud, and sets the state of a Losant Device. I first selected a specific device to set the state for, which worked great. As my project involves about 200 devices, I now want to include the Device ID in the payload, and use my Workflow to send data to the corresponding Losant Device. See image below.

Unfortunately, it hasn’t been working out so far. While my payload does include the device-id, when I specify the JSON path as data.body.device-id I do not see my data appearing anywhere. I have one Losant Device with a Device name that exactly matches the ID that I send with my payload.

Any ideas?


#2

Based on your screenshot, you seem to have set things up correctly. What appears in the Application Communication Log when you attempt to report state? There could be a number of reasons why a state report could be rejected - the application log entry will hopefully say why.


#3

Here is my Application Log:

It simply states: “Webhook Particle Cloud was triggered”


#4

I went and took a look at your application - it looks like 330045001347373036343935 is the name of your device, not the ID of the device. The ID of your device is 5c10137e13bed00009ebae81 - you can see the ID of a device in the box on the upper right hand corner of your device’s detail page in Losant.


#5

Yeah, actually I just realized that - the Device ID I include in my payload is my Particle device ID, which of course is different from the device ID in Losant.

So, what would you recommend me to do for my project? I have 200 devices all running identical firmware, publishing their data to the Particle Cloud on an hourly basis. I’m currently POST’ing this data to Losant with a single Webhook. In Losant, I’d like to have a separate dashboard for each device. The way I see it now, this would only be possible by including the Losant device ID in my payload, which is troublesome and time-consuming, moreso because I want to get up to 1000 of these devices eventually.

is there any way I can just separate out the data based on Particle device ID?


#6

We actually have a blog post about this exact topic! Some of the sceenshots may be out of date a bit, but the concepts are exactly what you are looking for.


#7

Thanks, I followed the tutorial post and everything seems to work great now :slight_smile: