# To support wildcard certificates, try to find existig TXT record and update it.
_info "Search existing TXT record"
if _constellix_rest GET "domains/${_domain_id}/records/TXT/search?exact=${_sub_domain}";then
ifprintf -- "%s""$response"| grep "{\"errors\":\[\"Requested record was not found\"\]}" >/dev/null;then
_info "Adding TXT record"
_info "Adding TXT record"
if _constellix_rest POST "domains/${_domain_id}/records""[{\"type\":\"txt\",\"add\":true,\"set\":{\"name\":\"${_sub_domain}\",\"ttl\":120,\"roundRobin\":[{\"value\":\"${txtvalue}\"}]}}]";then
if _constellix_rest POST "domains/${_domain_id}/records""[{\"type\":\"txt\",\"add\":true,\"set\":{\"name\":\"${_sub_domain}\",\"ttl\":60,\"roundRobin\":[{\"value\":\"${txtvalue}\"}]}}]";then