rest-server-example.c : A RESTful server example showing how to use the REST layer to develop server-side applications (possible to run it over either COAP or HTTP)
To use COAP as the underlying application protocol, one should define WITH_COAP = 1 in rest-example/Makefile. Otherwise, HTTP is used.
Look at the source code to see which resources are available. (check the RESOURCE macros in the code).
>curl -X POST -H "User-Agent: curl" aaaa::0212:7402:0002:0202:8080/helloworld #method not allowed
Accessing the server inside the sensor network:
(Note: Provided only for COAP implementation)
Start COOJA and load the simulation "coap-client-server-example.csc" by the following command.
> make TARGET=cooja coap-client-server-example.csc
coap-client-server-example.csc : Runs rest-server-example as the server (over COAP) (IP:aaaa::0212:7401:0001:0101) in one node and coap-client-example as the client (IP: aaaa::0212:7402:0002:0202) in another node.
Client periodically accesses resources of server and prints the payload.
To run REST server on real nodes under Linux
--------------------------------------------
1. Program the nodes with the rest-server-example
> make TARGET=sky rest-server-example.upload
2. Disconnect the nodes and program one node with the RPL border router
> (cd ../ipv6/rpl-border-router && make TARGET=sky border-router.upload)
3. Connect to the border router using tunslip6:
> make connect-router
4. Reconnect the motes, reboot them and note their IP addresses.