/dns/domain_templates/update_record
POST https://api.sitehost.nz/1.0/dns/domain_templates/update_record.json
Updates a record in a template.
Form Parameters
Parameter | Type | Required | Description |
client_id | integer | Yes | The ID for the client that the DNS zone belongs to.Example: 1 |
template_id | integer | Yes | The template ID number.Example: 1 |
record_id | integer | Yes | The record ID number.Example: 1 |
type | string | Yes | The type of the record.Example: A |
name | string | Yes | The name of the record.Example: subdomain |
content | string | Yes | The content of the record.Example: 192.168.1.10 |
prio | integer | The priority number of the record.Example: 10 |
Code Samples
JavaScript PHP Rails Pythonvar xmlHttp = new XMLHttpRequest();
xmlHttp.open("POST", "https://api.sitehost.nz/1.0/dns/domain_templates/update_record.json", false);
var data = new FormData();
data.append("apikey", "your_key_here");
data.append("client_id", "1");
data.append("template_id", "1");
data.append("record_id", "1");
data.append("type", "A");
data.append("name", "subdomain");
data.append("content", "192.168.1.10");
data.append("prio", "10");
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_record.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,
'record_id' => 1,
'type' => 'A',
'name' => 'subdomain',
'content' => '192.168.1.10',
'prio' => 10,
);
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_record.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,
"record_id" => 1,
"type" => "A",
"name" => "subdomain",
"content" => "192.168.1.10",
"prio" => 10,
}
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_record.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['record_id'] = 1
body['type'] = 'A'
body['name'] = 'subdomain'
body['content'] = '192.168.1.10'
body['prio'] = 10
response = requests.post(uri, data=body)
Response
200:application/json
{
"msg": "Successful.",
"status": true,
"time": 32
}
"msg": "Successful.",
"status": true,
"time": 32
}