Trying to post data to emoncms


#1

1) Give a description of the problem
I’m trying to post data to a emoncms server and I have built the URL but webcore is generating an error, but if I copy and paste the ULR in the browser it works fine

2) What is the expected behaviour?
To post results to emoncms server

3) What is happening/not happening?
getting error
║║Error executing external web request: java.net.URISyntaxException: Illegal character in query at index 81: http://somewebsite:8080/emoncms/input/post?node=Node&fulljson={"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature":65,"CadenTemperature":63,"KieraTemperature":63,"KitchenTemperature":67.1}&apikey=SOMEKEY

**4) Post a Green Snapshot of the piston!

5) Attach logs after turning logging level to Full
(PASTE YOUR LOGS HERE THEN HIGHLIGHT ALL OF THE LOGS AND CLICK ON THE </> ICON TO FORMAT THEM CORRECTLY)

5/14/2019, 10:32:55 AM +195ms
+58ms ╔Stopping piston...
+158ms ╚Piston successfully stopped (100ms)
5/14/2019, 10:32:55 AM +195ms
+58ms ╔Stopping piston...
+158ms ╚Piston successfully stopped (100ms)
5/14/2019, 10:32:43 AM +161ms
+1ms ╔Received event [Home].time = 1557844363699 with a delay of -538ms
+178ms ║RunTime Analysis CS &gt; 92ms &gt; PS &gt; 61ms &gt; PE &gt; 24ms &gt; CE
+181ms ║Runtime (44354 bytes) successfully initialized in 61ms (v0.3.10a.20190223) (176ms)
+182ms ║╔Execution stage started
+196ms ║║Cancelling statement #2's schedules...
+213ms ║║Executed virtual command [Cadens Room, Downstairs, Energy Meter, Kieras Room, Sensor, Upstairs].setVariable (3ms)
+225ms ║║Executed virtual command [Cadens Room, Downstairs, Energy Meter, Kieras Room, Sensor, Upstairs].setVariable (3ms)
+237ms ║║Executed virtual command [Cadens Room, Downstairs, Energy Meter, Kieras Room, Sensor, Upstairs].setVariable (3ms)
+252ms ║║Executed virtual command [Cadens Room, Downstairs, Energy Meter, Kieras Room, Sensor, Upstairs].setVariable (4ms)
+264ms ║║Executed virtual command [Cadens Room, Downstairs, Energy Meter, Kieras Room, Sensor, Upstairs].setVariable (4ms)
+279ms ║║Executed virtual command [Cadens Room, Downstairs, Energy Meter, Kieras Room, Sensor, Upstairs].setVariable (3ms)
+290ms ║║Executed virtual command [Cadens Room, Downstairs, Energy Meter, Kieras Room, Sensor, Upstairs].setVariable (4ms)
+323ms ║║Calculating (string) {"Power": + (string) 3323 &gt;&gt; (string) {"Power":3323
+333ms ║║Calculating (string) {"Power":3323 + (string) ,"Energy": &gt;&gt; (string) {"Power":3323,"Energy":
+343ms ║║Calculating (string) {"Power":3323,"Energy": + (string) 21.674 &gt;&gt; (string) {"Power":3323,"Energy":21.674
+354ms ║║Calculating (string) {"Power":3323,"Energy":21.674 + (string) ,"DownstairsTemperature": &gt;&gt; (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature":
+363ms ║║Calculating (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature": + (string) 67 &gt;&gt; (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature":67
+372ms ║║Calculating (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature":67 + (string) ,"UpstairsTemperature": &gt;&gt; (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature":
+382ms ║║Calculating (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature": + (string) 65 &gt;&gt; (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature":65
+390ms ║║Calculating (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature":65 + (string) ,"CadenTemperature": &gt;&gt; (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature":65,"CadenTemperature":
+397ms ║║Calculating (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature":65,"CadenTemperature": + (string) 63 &gt;&gt; (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature":65,"CadenTemperature":63
+403ms ║║Calculating (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature":65,"CadenTemperature":63 + (string) ,"KieraTemperature": &gt;&gt; (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature":65,"CadenTemperature":63,"KieraTemperature":
+410ms ║║Calculating (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature":65,"CadenTemperature":63,"KieraTemperature": + (string) 63 &gt;&gt; (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature":65,"CadenTemperature":63,"KieraTemperature":63
+416ms ║║Calculating (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature":65,"CadenTemperature":63,"KieraTemperature":63 + (string) ,"KitchenTemperature": &gt;&gt; (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature":65,"CadenTemperature":63,"KieraTemperature":63,"KitchenTemperature":
+421ms ║║Calculating (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature":65,"CadenTemperature":63,"KieraTemperature":63,"KitchenTemperature": + (string) 67.1 &gt;&gt; (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature":65,"CadenTemperature":63,"KieraTemperature":63,"KitchenTemperature":67.1
+426ms ║║Calculating (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature":65,"CadenTemperature":63,"KieraTemperature":63,"KitchenTemperature":67.1 + (string) } &gt;&gt; (string) {"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature":65,"CadenTemperature":63,"KieraTemperature":63,"KitchenTemperature":67.1}
+433ms ║║Executed virtual command [Cadens Room, Downstairs, Energy Meter, Kieras Room, Sensor, Upstairs].setVariable (3ms)
+453ms ║║Executed virtual command [Cadens Room, Downstairs, Energy Meter, Kieras Room, Sensor, Upstairs].setVariable (3ms)
+533ms ║║Sending external web request to: WEBPAGE/emoncms/input/post?node=RockHouse&amp;fulljson={"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature":65,"CadenTemperature":63,"KieraTemperature":63,"KitchenTemperature":67.1}&amp;apikey=APIkey
+548ms ║║Error executing external web request: java.net.URISyntaxException: Illegal character in query at index 81: http://WEBPAGE/emoncms/input/post?node=RockHouse&amp;fulljson={"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature":65,"CadenTemperature":63,"KieraTemperature":63,"KitchenTemperature":67.1}&amp;apikey=APIkey
+551ms ║║Executed virtual command [Cadens Room, Downstairs, Energy Meter, Kieras Room, Sensor, Upstairs].httpRequest (86ms)
+556ms ║╚Execution stage complete. (374ms)
+560ms ║Setting up scheduled job for Tue, May 14 2019 @ 10:33:13 AM EDT (in 29.98s)
+570ms ╚Event processed successfully (569ms)
5/14/2019, 10:32:21 AM +395ms
+1ms ╔Received event [Home].test = 1557844341394 with a delay of 0ms
+105ms ║RunTime Analysis CS &gt; 25ms &gt; PS &gt; 31ms &gt; PE &gt; 49ms &gt; CE
+108ms ║Runtime (44351 bytes) successfully initialized in 31ms (v0.3.10a.20190223) (106ms)
+110ms ║╔Execution stage started
+140ms ║╚Execution stage complete. (31ms)
+144ms ║Setting up scheduled job for Tue, May 14 2019 @ 10:32:43 AM EDT (in 22.161s)
+156ms ╚Event processed successfully (155ms)
5/14/2019, 10:32:13 AM +120ms
+1ms ╔Starting piston... (v0.3.10a.20190223)
+339ms ║╔Subscribing to devices...
+525ms ║║Subscribing to Cadens Room...
+527ms ║║Subscribing to Downstairs...
+529ms ║║Subscribing to Energy Meter...
+531ms ║║Subscribing to Kieras Room...
+533ms ║║Subscribing to Sensor...
+535ms ║║Subscribing to Upstairs...
+538ms ║╚Finished subscribing (201ms)
+634ms ║Setting up scheduled job for Tue, May 14 2019 @ 10:32:43 AM EDT (in 29.946s)
+647ms ╚Piston successfully started (646ms)

#2

Check for white space and other characters? I believe some browsers automatically do that urlencode which is why it works for when you do it directly.

Edit: You might be able to cheat by using urlEncode()


#3

I do not see any white space in this URL
http://WEBPAGE/emoncms/input/post?node=RockHouse&amp;amp;fulljson={"Power":3323,"Energy":21.674,"DownstairsTemperature":67,"UpstairsTemperature":65,"CadenTemperature":63,"KieraTemperature":63,"KitchenTemperature":67.1}&amp;amp;apikey=APIkey

It says at index 81 which is either the = sign or {


#4

I tried the urlEncode() but that seemed to make it worse and added an extra https:// for some reason


#5

found out it was the { and } had to replace with urlEncode version %7B and %7D