Domains : DNS template update
Omschrijving
Wijzig de TTL (Time To Live) van de DNS zoneEndpoint
PATCH https://api.mijndomeinreseller.nl/v2/dns/templates/dnstemplate
Parameters
Parameter | Datatype | Verplicht | Omschrijving |
---|---|---|---|
template_name | String | Nee | De nieuwe naam van de DNS template |
ttl | Integer | Nee | De nieuwe TTL van de domeinnaam in seconden: minimaal 1, maximaal 604800 (7 dagen) |
Antwoord
HTTP status code: 204 No Content
Voorbeeld
Beschrijving:
Wijzig de TTL en de naam van de template met ID 48df0d8f3f63aed3
Opdracht in PHP:
<?php $env = "live"; // live or test $api_key = "XXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $api_url = "/v2/domains/testdomeinnaam.nl/dns/templates/48df0d8f3f63aed3"; $api_host = $env === "live" ? "https://api.mijndomeinreseller.nl" : "https://api-test.mijndomeinreseller.nl"; $a_data = ["ttl" => 7200, "template_name" => "some-template-name"]; $json_data = json_encode($a_data); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $api_host . $api_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PATCH"); curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data ); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer $api_key","Content-Type: application/json")); $output = curl_exec($ch); if(curl_getinfo($ch, CURLINFO_HTTP_CODE) === 204) { echo "Template succesfully updated"; } curl_close($ch);
Opdracht in cURL:
curl -X PATCH -H "Content-Type: application/json" -H "Authorization: Bearer XXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \ -d '{"template_name":"some-template-name", "ttl":7200}' \ https://api-test.mijndomeinreseller.nl/v2/dns/templates/48df0d8f3f63aed3
HTTP/1.1 204 OK