Hope somebody can help. I’m completely new to this and have very little experience with JSON and programming in general. I am trying to set up a webhook to PUT data into a 3rd party Data Portal. It requires that the data be in a certain format. I have got the the webhook to work with the following JSON example, which updates the temperature data on the portal with a hard coded value of ‘14.66’
{
“docType”: “jts”,
“version”: “1.0”,
“header”: {
“columns”: {
“0”: {
“series”: “temp1”,
“name”: “Temperature”,
“dataType”: “NUMBER”,
“units”: “°C”
}
}
},
“data”: [
{
“ts”: “{{PARTICLE_PUBLISHED_AT}}”,
“f”: {
“0”: {
“v”: 14.66
}
}
}
]
}
Now, the value I actually want to send is {{PARTICLE_EVENT_VALUE}}.
If I replace the ‘14.66’ line with the following line,
“v”: "{{PARTICLE_EVENT_VALUE}}"
my data portal does not process the PUT request:
I have read the Particle Webhooks tutorial by Rickkas7, which was helpful and I understand that the issue is because {{PARTICLE_EVENT_VALUE}} is treated as a string. The tutorial says I can overcome this issue using a body definition, giving examples such as:
“body”:"{“a”:{{a}}}"
I am unsure how to implement this into the the JSON script shown above. Could anybody provide a practical example of how I can use a body definition in the code?
Many thanks