summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-05-20 20:18:33 +0200
committertv <tv@shackspace.de>2015-05-20 20:18:33 +0200
commit31dd668d39e0305ca86ad50c25ae98329e3ffe1f (patch)
treeb41b0455419b4a6a2343da0d12833fc7b9d03567
parenta3f87cec68f581b5495d8c6c0dc604b241a659b2 (diff)
lib/cac.sh: add _cac_post_api_v1
-rw-r--r--lib/cac.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/cac.sh b/lib/cac.sh
index 83f17635f..40b2760c2 100644
--- a/lib/cac.sh
+++ b/lib/cac.sh
@@ -19,6 +19,17 @@ _cac_get_api_v1() {
-G "https://panel.cloudatcost.com/api/v1/$1.php"
}
+_cac_post_api_v1() {
+ _cac_exec curl -fsS \
+ $(shift
+ set -- "$@" login="$cac_login" key="$cac_key"
+ for arg; do
+ echo -d $(printf '%s' "$arg" | url_encode)
+ done
+ ) \
+ -X POST "https://panel.cloudatcost.com/api/v1/$1.php"
+}
+
cac_listservers() {
_cac_get_api_v1 listservers
}