Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision Next revision Both sides next revision | ||
en:protocole_json [2014/05/20 00:29] naguirre created |
en:protocole_json [2014/05/20 08:44] admin [Wget Example] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Calaos Webservice protocol ====== | ====== Calaos Webservice protocol ====== | ||
- | Calaos server has a communication protocol | + | Calaos server has a communication protocol |
===== Requests details ===== | ===== Requests details ===== | ||
- | Requests are made via HTTPS directly on calaos server. Requests have the following URL :: | + | Requests are made via HTTPS directly on calaos server. Requests have to be done on the following URL : |
https:// | https:// | ||
Line 11: | Line 11: | ||
===== Testing ===== | ===== Testing ===== | ||
- | It' | + | It is possible to test the API using command line tools like [[http:// |
==== Wget Example ==== | ==== Wget Example ==== | ||
- | Data to be sent has the JSON format | + | Data in JSON format are placed |
wget --no-check-certificate --post-file query.json --output-document result.json https:// | wget --no-check-certificate --post-file query.json --output-document result.json https:// | ||
- | ==== Wget Example ==== | ||
- | |||
- | TBC | ||
===== API Calaos Network ===== | ===== API Calaos Network ===== | ||
Line 33: | Line 30: | ||
With this command you can get the complete configuration of the house. | With this command you can get the complete configuration of the house. | ||
- | === Exeaple | + | === Example |
- | Json Data to be send : | + | Json Data to be sent : |
{ | { | ||
" | " | ||
Line 152: | Line 149: | ||
} | } | ||
| | ||
- | The answer | + | The answer |
==== get_state ==== | ==== get_state ==== | ||
- | This command may be used to get the state of one or many Input/ | + | This command may be used to get the state of one or many Input/ |
- | === Exeample | + | === Example |
- | JSON Data to be send | + | JSON Data to be sent |
{ | { | ||
" | " | ||
Line 199: | Line 196: | ||
} | } | ||
- | The answer | + | Answer |
==== set_state ==== | ==== set_state ==== | ||
- | This command is used to change the state of one or many I/O. Parameters contains the ID of I/o, those found in the [[protocole_tcp|the TCP Protocole]]. | + | This command is used to change the state of one or many I/O. Parameters contains the ID of I/O, as in the [[protocole_tcp|TCP |
- | === Exemple | + | === Example |
- | JSON data to be send : | + | JSON data to be sent : |
{ | { | ||
" | " | ||
Line 223: | Line 220: | ||
} | } | ||
- | If you want to force the value of an input, you can chante the type by : | + | If you want to force the value of an input, you need to set type to " |
" | " | ||
| | ||
- | Command may also be sent to the music zone. Those commande | + | Command may also be sent to the music zones. Those commands |
- | === Exemple | + | === Example |
- | JSON Data to be send : | + | JSON Data to be sent : |
{ | { | ||
" | " | ||
Line 240: | Line 237: | ||
} | } | ||
- | We can also send data to a motorised | + | We can also send data to a camera |
=== Example === | === Example === | ||
- | JSON Data to be send : | + | JSON Data to be sent : |
{ | { | ||
" | " | ||
Line 261: | Line 258: | ||
=== Example === | === Example === | ||
- | Données | + | JSON Data to be sent : |
{ | { | ||
" | " | ||
Line 269: | Line 266: | ||
} | } | ||
- | You can alos add the parameters // | + | You can also add the parameters // |
Answer: | Answer: | ||
Line 302: | Line 299: | ||
} | } | ||
- | The answer contains the list of tracks | + | The answer contains the list of tracks |
==== poll_listen ==== | ==== poll_listen ==== | ||
- | This command is used to monitor all the changes of an IO of the server. | + | This command is used to monitor all the changes of an IO of the server. |
=== Register === | === Register === | ||
- | To register and get an unique ID, you have to send the following request : | + | To register and get a unique ID, you have to send the following request : |
{ | { | ||
" | " | ||
Line 323: | Line 320: | ||
} | } | ||
- | This ID is unique and is valid as long as you used it. If it' | + | This ID is unique and is valid as long as you used it. If not used within 5 min, it becomes |
=== Remove === | === Remove === | ||
- | When you have finished listening changes on an IO, you can remove this ID. Deleting an ID is not mandatory, as it's always done after 5min on inactivity. | ||
- | JSON Data to be send : | + | When you have finished listening changes on an IO, you can remove this ID. Deleting an ID is not mandatory, as it's always done after 5 min on inactivity. |
+ | |||
+ | JSON Data to be sent : | ||
{ | { | ||
" | " | ||
Line 344: | Line 342: | ||
=== Get Events === | === Get Events === | ||
- | Once the registration is done and you get an unique ID, you can ask the server periodically to know what happens | + | Once the registration is done and you have your unique ID, you can ask the server periodically to know what happens. The answer are the same as those sent by the //listen// command |
- | JSON Data to be send: | + | JSON Data to be sent: |
{ | { | ||
" | " | ||
Line 371: | Line 369: | ||
=== get === | === get === | ||
- | To retrieve the whole config you can use the following request : | + | To retrieve the whole config you need to use the following request : |
{ | { | ||
" | " | ||
Line 390: | Line 388: | ||
=== put === | === put === | ||
- | To send the configuration on the server you can use the following request | + | To send the configuration on the server you need to use the following request |
{ | { | ||
" | " |