/dns/domain_templates/update_template
POST https://api.sitehost.nz/1.0/dns/domain_templates/update_template.json
Updates a template.
Form Parameters
Parameter | Type | Required | Description |
client_id | integer | Yes | The ID for the client.Example: 1 |
template_id | integer | Yes | The template ID number.Example: 1 |
new_name | string | Yes | The new template name.Example: New Template Name |
options[Nameserver] | string | The name server.Example: ns1.sitehost.co.nz | |
options[Email] | string | The email address.Example: new_email@example.com | |
options[Refresh] | integer | The refresh value.Example: 600 | |
options[Retry] | integer | The retry value.Example: 600 | |
options[Expire] | integer | The expire value.Example: 600 | |
options[Min] | integer | The minimum value.Example: 3600 |
Code Samples
JavaScript PHP Rails Pythonvar xmlHttp = new XMLHttpRequest();
xmlHttp.open("POST", "https://api.sitehost.nz/1.0/dns/domain_templates/update_template.json", false);
var data = new FormData();
data.append("apikey", "your_key_here");
data.append("client_id", "1");
data.append("template_id", "1");
data.append("new_name", "New Template Name");
data.append("options[Nameserver]", "ns1.sitehost.co.nz");
data.append("options[Email]", "new_email@example.com");
data.append("options[Refresh]", "600");
data.append("options[Retry]", "600");
data.append("options[Expire]", "600");
data.append("options[Min]", "3600");
xmlHttp.send(data);
var response = xmlHttp.responseText;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.sitehost.nz/1.0/dns/domain_templates/update_template.json");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
$body = array(
'apikey' => 'your_key_here',
'client_id' => 1,
'template_id' => 1,
'new_name' => 'New Template Name',
'options[Nameserver]' => 'ns1.sitehost.co.nz',
'options[Email]' => 'new_email@example.com',
'options[Refresh]' => 600,
'options[Retry]' => 600,
'options[Expire]' => 600,
'options[Min]' => 3600,
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
require 'net/http'
require 'uri'
uri = URI.parse("https://api.sitehost.nz/1.0/dns/domain_templates/update_template.json")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri)
body = {"apikey" => "your_key_here",
"client_id" => 1,
"template_id" => 1,
"new_name" => "New Template Name",
"options[Nameserver]" => "ns1.sitehost.co.nz",
"options[Email]" => "new_email@example.com",
"options[Refresh]" => 600,
"options[Retry]" => 600,
"options[Expire]" => 600,
"options[Min]" => 3600,
}
request.set_form_data(body)
response = http.request(request)
import requests
from collections import OrderedDict
uri = 'https://api.sitehost.nz/1.0/dns/domain_templates/update_template.json'
# We need ordered dictionary because parameters have to be in the right order.
# Refer to Developer Notes for more information.
body = OrderedDict()
body['apikey'] = 'your_key_here'
body['client_id'] = 1
body['template_id'] = 1
body['new_name'] = 'New Template Name'
body['options[Nameserver]'] = 'ns1.sitehost.co.nz'
body['options[Email]'] = 'new_email@example.com'
body['options[Refresh]'] = 600
body['options[Retry]'] = 600
body['options[Expire]'] = 600
body['options[Min]'] = 3600
response = requests.post(uri, data=body)
Response
200:application/json
{
"msg": "Successful.",
"status": true,
"time": 32
}
"msg": "Successful.",
"status": true,
"time": 32
}