osd-contiki/examples/rest-example
2010-11-23 20:59:26 +00:00
..
Makefile Removing unnecessary files to add the new ones. 2010-11-23 20:59:26 +00:00
project-conf.h Changed name of web-conf.h to project-conf.h 2010-10-28 13:11:08 +00:00
README removed info about COAPTester since it is not included in Contiki 2010-10-29 08:57:56 +00:00

COOJA RUN:

Open a terminal and go to "rest" directory.
In rest/Makefile, define WITH_COAP = 1 if you want to use COAP, rather than HTTP.
Issue following command to load and compile Rest api with COOJA.
>make rest-example-no-rpl.csc TARGET=cooja

In another terminal, issue the following command
>make connect-router-cooja

There are 2 nodes running the Rest code in COOJA (node 2 and 6). Their IP addresses are aaaa::0212:7402:0002:0202 and aaaa::0212:7406:0006:0606 respectively.

TEST:
Please check the rest/rest-example.c source code to see which resources are available. (check the RESOURCE macros in the code).


HTTP Examples
You can use curl as an http client to interact with the COOJA motes running REST code.
curl -H "User-Agent: curl" aaaa::0212:7402:0002:0202:8080/helloworld #get helloworld plain text
curl -H "User-Agent: curl" aaaa::0212:7402:0002:0202:8080/led?color=green -d mode=off -i #turn off the green led
curl -H "User-Agent: curl" aaaa::0212:7402:0002:0202:8080/.well-known/core -i
curl -X POST -H "User-Agent: curl" aaaa::0212:7402:0002:0202:8080/helloworld #method not allowed

COAP Examples:
You need a COAP client to be able to to interact with the COOJA motes running REST code. URIs are same with the HTTP examples.