/dns/distribution/zones/{name}
0.2.28Unchanged since publicationCreate or replace a client's DNS zone on a distribution node
noneAuthenticate with the client's DNS distribution key in the Authorization: Bearer KEY header. Send the client's registered IPv4 address in X-Urbestack-Address and make the request from that IPv4 address. A missing or invalid IPv4 address in the header returns 400. A mismatch between the header, the source IPv4 address, and the registered IPv4 address returns 403. If the node's license prevents changes, the operation returns 402.
An unknown key returns 401. For seven days after a client or node is removed from the network, its former key returns 403 with removal details. For seven days after the receiving server leaves or is removed from the network, it returns 410 to clients whose keys it still recognizes and identifies the remaining nodes. Other requests to a server outside the network return 401.
Each entry in rows contains name, type, ttl, priority, and content. rows defaults to an empty array. Send the client's ACME challenges as TXT records. Omit the SOA record and apex NS set from rows because the receiving node generates them. The node validates each record and checks the resulting zone with named-checkzone before storing it. A validation failure or a mismatch between the supplied hash and the hash computed by the node returns 400 before any zone changes are saved.
Use 64 lowercase hexadecimal digits for hash and 1 to 10 digits with no leading zero for serial. hostmaster accepts an email address or a DNS name whose first label identifies the mailbox, up to 320 characters. ttl is the zone's default TTL in seconds, from 1 to 604800. Supply soa as an object with refresh, retry, expire, and negative, or as four space-separated integers in that order. The ranges in seconds are 60 to 604800 for refresh and retry, 3600 to 31536000 for expire, and 0 to 86400 for negative.
The node assigns a new zone to the client and returns 201. For an existing zone held by that client, it replaces the previous records with the submitted records and returns 200. If another client or the receiving server holds the zone, the operation returns 409 and names the current holder. Both success responses include zone, the created flag, the record count in rows, the computed hash, DNS publication details in dns, and the current nameservers and nodes.
As a command
Run as root on the serverrowsarray of DnsDistributionRowRequiredhashstringhostmasterstring, up to 320 charactersserialintegersoaobjectsoa.expireintegersoa.negativeintegersoa.refreshintegersoa.retryintegerttlintegerExample
See the API overview for how to set $API and $TOKEN.curl -sS -X PUT "$API/dns/distribution/zones/{name}" \
-H "Content-Type: application/json" \
-d '{
"hash": "text",
"hostmaster": "text",
"rows": [
{
"content": "text",
"name": "alice",
"priority": 1,
"ttl": 1,
"type": "rebuild"
}
],
"serial": 1,
"soa": {
"expire": 1,
"negative": 1,
"refresh": 1,
"retry": 1
},
"ttl": 1
}'200 OK{
"created": true,
"dns": {},
"hash": "text",
"nameservers": [
"text"
],
"nodes": [
{
"address": "info@example.com",
"hostname": "server.example.com",
"ipv4": "text",
"ipv6": "text",
"nameservers": [
"text"
],
"port": 8443
}
],
"rows": 1,
"zone": "text"
}Errors
17 errors, each a status and a sentence400--address is required400Domain name required400Domain name too long400Invalid IPv4 address400Invalid IPv6 address400Invalid domain name400Invalid email address400Invalid port400Invalid setting key400X-Urbestack-Address must carry the client's own IPv4 address401Unknown key402This node refuses changes: <why>403The call came from <remote> but the server says its address is <said>. A server behind NAT cannot be a client403This key belongs to the client at <c.address>, and the call came from <remote>403This server was removed from the distribution network on 404Setting '<key>' not found410This server is no longer a node of the distribution network: it urbestack.com/docs/api/put-dns-distribution-zones-name/