Hello !!
I am trying to send weather data to Weather Underground from my Particle Boron (which is attached to an IoT Node device), but keep getting an error 400 code each time the webhook is called. According to Weather Underground, the upload protocol should be in the following format:
I have created a webhook called “WUBulkWriteCSV” that has 4 form fields, as follows:
- ID > {{id}} (for Weather Underground station ID)
- PASSWORD > {{pw}} (for Weather Underground password)
- dateutc > {{d}} (for current date)
- data > {{data}}
===========
Within Particle IDE, I have the following lines of code:
String wuStationID = “KCAVISTA171”;
String wuPassword = “XXXXX”;
String dateUTC;
String data = “{“ID=”:”" + wuStationID + “”,“PASSWORD=”:"" + wuPassword + “”,“dateutc=”:"" + dateUTC + “”,“data”:"" + csvDataWU+ “”}";
Particle.publish(“WUBulkWriteCSV”, data);
Here is the output of the webhook in “Pretty” form:
{
“ID=”: “KCAVISTA171”,
“PASSWORD=”: “XXXXX”,
“dateutc=”: “now”,
“data”: “winddir=270&windspeedmph=0&windgustmph=0&humidity=74&tempf=70.8&rainin=0&dailyrainin=0&baromin=29.48&solarradiation=0”
}
Here is the output of the webhook in “raw” form:
{“ID=”:“KCAVISTA171”,“PASSWORD=”:“XXXXX”,“dateutc=”:“now”,“data”:“winddir=270&windspeedmph=0&windgustmph=0&humidity=74&tempf=70.8&rainin=0&dailyrainin=0&baromin=29.48&solarradiation=0”}
============
Can you please help me figure out where the error is coming from? If I compare the upload protocol from Weather Underground with the output of my webhook, I notice that the upload protocol does not include any quotation marks, colons or commas between data fields, but the output of my webhook includes all three of these. In addition, all of their data fields are separated by the “&” symbol, and mine does not have this. I’m not sure how to fix this.
Would really appreciate advice on how to get this to work properly.
Thanks !!
Seth