Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:protocole_json [2016/07/28 13:31] mifrey [Wget Example] |
en:protocole_json [2021/09/16 21:39] (current) mifrey [In url with HTTP GET] |
||
---|---|---|---|
Line 11: | Line 11: | ||
===== Testing ===== | ===== Testing ===== | ||
+ | ==== Wget ==== | ||
It is possible to test the API using command line tools like [[http:// | It is possible to test the API using command line tools like [[http:// | ||
- | |||
- | ==== Wget Example ==== | ||
Data in JSON format are placed in the file // | Data in JSON format are placed in the file // | ||
- | wget --no-check-certificate --post-file query.json --output-document result.json https://ip_address/api.php | + | wget --no-check-certificate --post-file query.json --output-document result.json https://calaos_server_ip/api.php |
+ | |||
+ | ==== In url with HTTP GET ==== | ||
+ | |||
+ | The requests must be made with HTTP POST with Calaos v2. Calaos v3 also supports HTTP GET and it is therefore possible to send a request directly in the url. | ||
+ | |||
+ | Examples: | ||
+ | * Get the config: https:// | ||
+ | * Get a picture from a camera: https:// | ||
+ | * Set an output: https:// | ||
+ | * Set an intern variable: https:// | ||
+ | * Read a variable : https:// | ||
+ | |||
+ | That allows an external system that only supports HTTP GET to easily communicate to Calaos. | ||
+ | |||
+ | ==== HTML Page ==== | ||
+ | |||
+ | Calaos v3 includes a debug web page to test the POST and Websocket requests. | ||
+ | |||
+ | We need first to activate the debug mode with following command: | ||
+ | < | ||
+ | calaos_config set debug_enabled true | ||
+ | </ | ||
+ | or directly add it in the file /// | ||
+ | |||
+ | The page is then accessible from https:// | ||
+ | |||
+ | {{ : | ||
==== Use the API with other languages ==== | ==== Use the API with other languages ==== | ||
+ | * [[json_python2|Python 2]] | ||
* [[json_python3|Python 3]] | * [[json_python3|Python 3]] | ||