mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2025-07-03 18:22:44 +00:00
Fix simply.com API
- Rename API to dns_simplycom.sh, since "simply" is ambiguous, the name of the company is "Simply.com". - Normalize JSON and fix not handling return code correctly - Add some information to comments - Fix trailing slash on URIs
This commit is contained in:
parent
b335840f97
commit
2c9273b4de
@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
#
|
# API-integration for Simply.com (https://www.simply.com)
|
||||||
|
|
||||||
#SIMPLY_AccountName="accountname"
|
#SIMPLY_AccountName="accountname"
|
||||||
#
|
|
||||||
#SIMPLY_ApiKey="apikey"
|
#SIMPLY_ApiKey="apikey"
|
||||||
#
|
#
|
||||||
#SIMPLY_Api="https://api.simply.com/1/[ACCOUNTNAME]/[APIKEY]"
|
#SIMPLY_Api="https://api.simply.com/1/[ACCOUNTNAME]/[APIKEY]"
|
||||||
@ -51,7 +51,7 @@ dns_simply_rm() {
|
|||||||
|
|
||||||
_simply_save_config
|
_simply_save_config
|
||||||
|
|
||||||
_debug "First detect the root zone"
|
_debug "Find the DNS zone"
|
||||||
|
|
||||||
if ! _get_root "$fulldomain"; then
|
if ! _get_root "$fulldomain"; then
|
||||||
_err "invalid domain"
|
_err "invalid domain"
|
||||||
@ -151,7 +151,7 @@ _simply_save_config() {
|
|||||||
_simply_get_all_records() {
|
_simply_get_all_records() {
|
||||||
domain=$1
|
domain=$1
|
||||||
|
|
||||||
if ! _simply_rest GET "my/products/$domain/dns/records"; then
|
if ! _simply_rest GET "my/products/$domain/dns/records/"; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ _get_root() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! _simply_rest GET "my/products/$h/dns"; then
|
if ! _simply_rest GET "my/products/$h/dns/"; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ _simply_add_record() {
|
|||||||
|
|
||||||
data="{\"name\": \"$sub_domain\", \"type\":\"TXT\", \"data\": \"$txtval\", \"priority\":0, \"ttl\": 3600}"
|
data="{\"name\": \"$sub_domain\", \"type\":\"TXT\", \"data\": \"$txtval\", \"priority\":0, \"ttl\": 3600}"
|
||||||
|
|
||||||
if ! _simply_rest POST "my/products/$domain/dns/records" "$data"; then
|
if ! _simply_rest POST "my/products/$domain/dns/records/" "$data"; then
|
||||||
_err "Adding record not successfull!"
|
_err "Adding record not successfull!"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -214,7 +214,7 @@ _simply_delete_record() {
|
|||||||
|
|
||||||
_debug record_id "Delete record with id $record_id"
|
_debug record_id "Delete record with id $record_id"
|
||||||
|
|
||||||
if ! _simply_rest DELETE "my/products/$domain/dns/records/$record_id"; then
|
if ! _simply_rest DELETE "my/products/$domain/dns/records/$record_id/"; then
|
||||||
_err "Deleting record not successfull!"
|
_err "Deleting record not successfull!"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -245,6 +245,8 @@ _simply_rest() {
|
|||||||
response="$(_get "$SIMPLY_Api/$SIMPLY_AccountName/$SIMPLY_ApiKey/$ep")"
|
response="$(_get "$SIMPLY_Api/$SIMPLY_AccountName/$SIMPLY_ApiKey/$ep")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
response="$(echo "$response" | _normalizeJson)"
|
||||||
|
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
_err "error $ep"
|
_err "error $ep"
|
||||||
return 1
|
return 1
|
Loading…
x
Reference in New Issue
Block a user