You can execute a REST request from a console using the wget command. For example you can run:
$ wget -qO- http://127.0.0.1:40405/account/user/list
This will run the request and show you the results (thanks to the -qO- parameter).
In Domogik configuration file, there are several options about REST in [rest] section:
First, generate a self-signed certificate compounded of a certificate and a private key for your REST server with the following command (both certificate and key are put in a single file : domogik.pem):
$ openssl req -new -x509 -keyout domogik.pem -out domogik.pem -days 365 -nodes
This certificate is valid for one year. Adapt the days parameter (-days 365) to change this.
Then, set rest_use_ssl parameter to True and rest_ssl_certificate with the path to your certificate file.
Restart REST server.
If REST is on 127.0.0.1:40405, try a request on https://127.0.0.1:40405/ with your favorite browser. You should obtain something like:
{
"status" : "OK",
"code" : 0,
"description" : "None",
"rest" : [
{"Version" : "0.1"},
{"Description" : "REST module is part of Domogik project. See http://trac.domogik.org/domogik/wiki/modules/REST.en for REST API documentation"},
{"SSL" : "True"}
]
}
If this is OK with “SSL” : “True”, it works :)
Rest uses http status codes to identify the error: