I’ve got a weird issue with passing my payload from my electron to my REST receiver. In my code I have the following line.
message = "{\"_type\":\"location\",\"t\":\"a\",\"tid\":\"" + tid + "\",\"acc\":50,\"lat\":" + String(LATVAR) + ",\"lon\":" + String(LONVAR) + ",\"tst\":" + Time.now() + "}";
It creates a string similar to:
{"_type":"location","tid":"WP","acc":49,"lat":44.4536224,"lon":-85.6364103,"tst":1461720142}
However, when I set up my webhook, with this json
{
"topic": "owntracks/tC/tC",
"payload": "{{PARTICLE_EVENT_VALUE}}"
}
I get this as a response on the other end:
{"payload":"{"_type":"location","t":"a","tid":"TC","acc":50,"lat":,"lon":,"tst":1465621098}","topic":"owntracks/tC/tC"}
Any ideas on how I can format my data on the electron or the webhook config to get it to pull the data through clean?
I basically need the equivalent of this.
curl -X POST -H "Content-Type: application/json" -d '{"topic":"owntracks/tC/tC","payload":"Test"}' http://server/api/services/mqtt/publish