Help with HTTP Post Request


Running Webcore v0.3.10a

Im tearing my hair out (now bald :slight_smile: ) trying to figure out how to make a HTTP Post Request work. Getting unauthorized (or other errors depending on the variations I have tried) . All of this done on my local LAN … basically I am trying to have Webcore send some data to another device REST API (a raspberry) that uses an API Key for access.

This curl works as expected:

curl -X POST "" -H "accept: */*" -H "Content-Type: text/plain" -u oh.smartthings.rPYLEXSp0wWkPpwTJJtl8mph8hNI8hEkWvlBpQ2opV5vlGqVyM5uw21lzdP8fEzgGlQgWzDiqC6EePuu49A:

So I wrote the most basic webcore script I could:
Make a POST request to as type text/plain;
Log info “{$httpStatusCode}”;
Log info “{$httpContentType}”;
Log info “{$response}”;
end execute;

And here is the resulting response:

5/21/2021, 1:54:21 PM +223ms
+1ms	╔Received event [Elmwood].wc_async_reply = httpRequest with a delay of 0ms
+246ms	║Runtime (39565 bytes) successfully initialized in 84ms (v0.3.10a.20190223) (244ms)
+246ms	║╔Execution stage started
+263ms	║║401
+264ms	║║Executed virtual command log (2ms)
+268ms	║║application/json
+270ms	║║Executed virtual command log (1ms)
+274ms	║║{"error":{"message":"Authentication required","http-code":401}}
+275ms	║║Executed virtual command log (1ms)
+278ms	║╚Execution stage complete. (32ms)
+279ms	╚Event processed successfully (279ms)

What could I be doing wrong here? Any guesses?


Read the -u argument as username:password and either try writing the url as

http://username:[email protected]:8080/ ...

or alternatively put

Basic base64encoded

As a value in the Authorization header where base64encoded is the result of base64 encoding username:password.


Thanks - Have tried the:

http://username:[email protected]:8080/

Will play around with the base64encoded