HTTP/Web APIs

How to test?

- Make sure that swDuino server is up and running on your local computer or on some other computer which your computer can access on network.
- In the following, replace [server] with swDuino server IP address or hostname. localhost or 127.0.0.1 can also be used if swDuino is running on local machine. For [port], you can use 8085 if the default settings on swDuino server are not changed. Otherwise, use the port as set.

Server info

- Know state of server:
http://[server]:[port]/test or http://[server]:[port]

- Know server timer:
http://[server]:[port]/timer

- Know Serial/COM port:
http://[server]:[port]/com

GETting variables

These APIs will receive variables' value cached in HTTP server.

- Read a particular variable "P" (e.g. value of POT):
http://[server]:[port]/get/P

- Read all variables:
http://[server]:[port]/get

- Read all variables similar to P*:
http://[server]:[port]/getlike/P*
Use ? for a character or * for wild-match.

SETting variables

These APIs will send variables' value to HTTP server, which swDuino instantly sends to Serial/COM of Arduino. It is the combination of PUT and PUSH.

- Set value of a variable "junk" to "123":
http://[server]:[port]/set/junk/123

- Set value of a variable "led" to "1":
http://[server]:[port]/set/led/1

- Set value of variables similar to "l*d":
http://[server]:[port]/setlike/l*d/1
Make sure that the variable is already cached. Use ? for a character or * for wild-match.

PUTting variables

These APIs will send variables' value to HTTP server. No information is sent to Serial/COM.

- Put value of a variable "junk" to "123":
http://[server]:[port]/put/junk/123

- Put value of a variable "led" to "1" (led will not glow on board):
http://[server]:[port]/put/led/1

- Put value of variables similar to "l*d":
http://[server]:[port]/putlike/l*d/1
Make sure that the variable is already cached. Use ? for a character or * for wild-match.

PUSHing variables

These APIs will send variables' value from HTTP server cache to Serial/COM.

- Push value of a variable "junk":
http://[server]:[port]/push/junk

- Push value of variables similar to "l*d":
http://[server]:[port]/pushlike/l*d
Make sure that the variable is already cached. Use ? for a character or * for wild-match.

UNSETting variables

These APIs will delete variable from HTTP server cache. No information is sent to Serial/COM.

- Unset a variable "junk":
http://[server]:[port]/unset/junk

- Unset variables similar to "l*d":
http://[server]:[port]/unsetlike/l*d

- Unset all variables:
http://[server]:[port]/reset

Web server

Place your files (html, jpg etc.) in "files" folder and access them through browser.
The default file is index.html.

To browse home:
http://[server]:[port]/files