blob: 1eb0c4580a4ed52b31efbd231cf4dd2b71b10549 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail
shopt -s inherit_errexit lastpipe
readonly base_url='http://192.168.177.1:1234/'
run_curl() {
curl -sS -D - --connect-timeout 3 "$@" -- "$base_url"
}
run_curl_api() {
run_curl -H 'Content-Type: application/json' "$@"
}
call_api_method() {
local method
for method; do
echo ------------------------------------------------------------------
echo "Checking API method: $method"
echo ------------------------------------------------------------------
run_curl_api -d '{"jsonrpc": "2.0", "method": "'"$method"'", "params": {}}'
done
}
check_api() {
call_api_method ListPeers
call_api_method GetDeviceInfo
}
main() {
check_api
}
main
|