Monoprice Amp Web Request Help


#1

1) Give a description of the problem
Trying to send a web request that needs a carriage return (\r\n) sent as part of the request and haven’t been successful. Based on the API of the request, it needs to be in plain/text as the content type. This request gets sent over IP and converted to a RS232 connection.

2) What is the expected behavior?
Be able to send a carriage return in the request

3) What is happening/not happening?
I am able to send the command to the API to tun the receiver on/off however, it’s not taking because the carriage return is required for the command to go to the receiver.

**4) Post a Green Snapshot of the piston![image|45x37]


**5) Attach any logs
4/23/2019, 8:19:14 AM +138ms
+0ms ╔Received event [Home].wc_async_reply = httpRequest with a delay of 0ms
+85ms ║RunTime Analysis CS > 21ms > PS > 39ms > PE > 25ms > CE
+87ms ║Runtime (38625 bytes) successfully initialized in 39ms (v0.3.10a.20190223) (86ms)
+88ms ║╔Execution stage started
+101ms ║╚Execution stage complete. (13ms)
+103ms ╚Event processed successfully (104ms)
4/23/2019, 8:19:13 AM +685ms
+2ms ╔Received event [VS-Test Switch].switch = on with a delay of 717ms
+122ms ║RunTime Analysis CS > 23ms > PS > 70ms > PE > 29ms > CE
+125ms ║Runtime (38627 bytes) successfully initialized in 70ms (v0.3.10a.20190223) (121ms)
+126ms ║╔Execution stage started
+137ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+139ms ║║Cancelling condition #6’s schedules…
+141ms ║║Condition #6 evaluated true (8ms)
+142ms ║║Cancelling condition #5’s schedules…
+143ms ║║Condition group #5 evaluated true (state changed) (11ms)
+146ms ║║Cancelling statement #7’s schedules…
+154ms ║║Executed virtual command setVariable (4ms)
+161ms ║║Executed virtual command setVariable (3ms)
+169ms ║║Executed virtual command setVariable (3ms)
+181ms ║║Calculating (string) <16PR01 + (string)
+181ms ║║ >> (string) <16PR01
+186ms ║║Sending internal web request to: 192.168.1.20/api/v1/serialports/1/sendserial
+191ms ║║Executed virtual command httpRequest (6ms)
+193ms ║║Requesting a wake up for Tue, Apr 23 2019 @ 8:19:33 AM MDT (in 20.0s)
+198ms ║╚Execution stage complete. (73ms)
+200ms ║Setting up scheduled job for Tue, Apr 23 2019 @ 8:19:33 AM MDT (in 19.994s)
+210ms ╚Event processed successfully (209ms)


#2

In your post request it looks like you’re using single quotes around the \r\n. They should be double quotes I think. At least in normal HTML it is, so I assume it would be the same sending it from webcore.


#3

Either single or double quotes are acceptable… Just be consistent.


If you haven’t tried already, I would try an ‘Expression’ box, and actually press ‘Enter’ where you want the carriage return. (it has to be inside the quotes)


#4

I have tried the expression box as well. I am not sure since the content type is “plain/text” that it’s taking all the characters literally and not recognizing it that it’s a carriage return.
I got it to work through a basic web page POST call but I want to be able to call it through WebCore as part of piston automation and other rules.