if _contains "$response""Action completed successful";then
_contains "$response""Action completed successful"|| _contains "$response""Domain record already exists"
return 0
fi
return 1 #error
}
#update the txt record
#Usage: root sub txtvalue
update_record(){
root=$1
sub=$2
txtvalue=$3
fulldomain="$sub.$root"
_info "Updating record"
if! _rest POST "Record.Modify""login_token=$DP_Id,$DP_Key&format=json&domain_id=$_domain_id&sub_domain=$_sub_domain&record_type=TXT&value=$txtvalue&record_line=默认&record_id=$record_id";then
return 1
fi
if _contains "$response""Action completed successful";then
_LUA_rest PUT "zones/$_domain_id/records/$record_id""{\"id\":$record_id,\"type\":\"TXT\",\"name\":\"$fulldomain.\",\"content\":\"$txtvalue\",\"zone_id\":$_domain_id,\"ttl\":120}"