VPS.org API

Whakatuhi REST API

API Whakahaere DNS

Whakahaerehia ngā rohe me ngā tuhinga DNS mā te kaupapa mō ō rohe.

Ngā Pūtake 4 ngā pito
Ara Tūāpapa /api/v1/dns-zones
Whakamotuhēhēnga E hiahiatia ana te tohu kaiārahi

Tirohanga Whānui

Ka whakarato te DNS API i te whakahaeretanga katoa o nga rohe me nga pūkete DNS. Ka whakanohotia ngā rohe katoa ki runga i ngā pūnaha ingoa mana o te VPS.org me te whakanao me te whakataunga tāuru o te rohe BIND9.

Ka taea te whakataki i te pūnaha pūnaha

Āhuatanga kī

Whakamotuhēhēnga

E hiahiatia ana e ngā tono API DNS katoa te manatoko tohu Taketake. Whakanao i ngā tohu API mai i tō tātou papatono kāwanatanga ā-kōrero i te /account/developers/ me ēnei whakaaetanga:

Hei tauira

Authorization: Bearer vps_abc123def456...
Whakahauhau: Ko ngā tohu API e whakaaturia ana kotahi anake i te wā o te waihanga. Ka tiakina ā-tinanatia. Mēnā kua ngaro tētahi tohu, me waihanga tētahi hou.
TIKINA /api/v1/dns-zones/

Rārangihia ngā Rohe DNS Katoa

Ka whiwhi rātau i tētahi rārangi pāpāho o ngā rohe DNS katoa e noho ana ki te kaimahi whakatūturu. E tautoko ana i te tātaritanga e te ingoa rohe.

Ngā Tawhā Uiui

Parameter Momo E hiahiatia ana Whakamāramatanga
domain string Kāore Filter zones by exact domain name (e.g., example.com)

Tauira Tono

cURL
Python
JavaScript
curl -X GET "https://admin.vps.org/api/v1/dns-zones/" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
import requests

url = "https://admin.vps.org/api/v1/dns-zones/"
headers = {"Authorization": "Bearer YOUR_API_TOKEN"}

response = requests.get(url, headers=headers)
print(response.json())
const response = await fetch('https://admin.vps.org/api/v1/dns-zones/', {
  headers: {'Authorization': 'Bearer YOUR_API_TOKEN'}
});

const zones = await response.json();
console.log(zones);

Tauira Whakautu

[
  {
    "uuid": "abc123-def456-ghi789",
    "domain": "example.com",
    "created_at": "2024-01-15T10:30:00Z",
    "record_count": 12
  },
  {
    "uuid": "xyz789-uvw456-rst123",
    "domain": "myapp.io",
    "created_at": "2024-06-20T14:15:00Z",
    "record_count": 8
  }
]

Ngā Āpure Whakautu

Taiwhanga Momo Whakamāramatanga
uuid string Unique zone identifier (used in API requests)
domain string Domain name for this DNS zone
created_at datetime Zone creation timestamp (ISO 8601 format)
record_count integer Total number of DNS records in this zone

Ngā Waehere Tūnga Urupare

200 Successfully retrieved DNS zones list
401 Unauthorized - Invalid or missing API token
403 Forbidden - Token lacks dns:list permission
TIKINA /api/v1/dns-zones/{uuid}/

Ki te whiwhi mōhiohio rohe DNS

Ka whiwhi mōhiohio mārama mō tētahi rohe DNS tauwhāiti, tae atu ki ngā pūkete katoa.

Ngā Tawhā Ara

Parameter Momo E hiahiatia ana Whakamāramatanga
uuid string Āe Unique zone identifier

Tauira Whakautu

{
  "uuid": "abc123-def456-ghi789",
  "domain": "example.com",
  "created_at": "2024-01-15T10:30:00Z",
  "record_count": 5,
  "records": [
    {
      "uuid": "rec-001",
      "record_type": "A",
      "name": "@",
      "value": "192.0.2.1",
      "ttl": 3600,
      "priority": null,
      "created_at": "2024-01-15T10:30:00Z"
    },
    {
      "uuid": "rec-002",
      "record_type": "MX",
      "name": "@",
      "value": "mail.example.com",
      "ttl": 3600,
      "priority": 10,
      "created_at": "2024-01-15T10:32:00Z"
    }
  ]
}

Ngā Waehere Tūnga Urupare

200 Successfully retrieved zone details
404 Zone not found or not owned by user
POST /api/v1/dns-zones/

Ka waihanga tētahi rohe DNS

Ka waihanga tētahi rohe DNS hou mō tētahi rohe. Ka whakawāteatia te rohe kia VPS.org ngā pūnaha ingoa.

Tonohia ngā Tawhā Tinana

Parameter Momo E hiahiatia ana Whakamāramatanga
domain string Āe Domain name (e.g., example.com)

Tauira Tono

cURL
Python
JavaScript
curl -X POST "https://admin.vps.org/api/v1/dns-zones/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"domain": "newdomain.com"}'
import requests

url = "https://admin.vps.org/api/v1/dns-zones/"
headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}
data = {"domain": "newdomain.com"}

response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch('https://admin.vps.org/api/v1/dns-zones/', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({domain: 'newdomain.com'})
});

const zone = await response.json();
console.log(zone);

Tauira Whakautu

{
  "uuid": "new-zone-uuid",
  "domain": "newdomain.com",
  "created_at": "2026-01-18T16:45:00Z",
  "record_count": 0,
  "records": []
}

Ngā Waehere Tūnga Urupare

201 DNS zone created successfully
400 Bad Request - Invalid domain name or zone already exists
403 Forbidden - Token lacks dns:create permission
MUKU /api/v1/dns-zones/{uuid}/

Ka tangohia te rohe DNS

Ka tango tūturu tētahi rohe DNS me ngā pūkete pāhono katoa. Kāore e taea te whakakore i tēnei mahi.

Ngā Tawhā Ara

Parameter Momo E hiahiatia ana Whakamāramatanga
uuid string Āe Unique zone identifier

Ngā Waehere Tūnga Urupare

204 Zone deleted successfully (no response body)
403 Forbidden - Token lacks dns:delete permission
404 Zone not found
TIKINA /api/v1/dns-zones/{uuid}/records/

Tatauranga o ngā pūkete DNS i roto i te rohe

Ka whiwhi ngā pūkete DNS katoa mō tētahi rohe tauwhāiti (ngā ara whakatata).

Ngā Tawhā Ara

Parameter Momo E hiahiatia ana Whakamāramatanga
uuid string Āe Zone UUID

Tauira Tono

curl -X GET "https://admin.vps.org/api/v1/dns-zones/{uuid}/records/" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Tauira Whakautu

[
  {
    "uuid": "rec-001",
    "record_type": "A",
    "name": "@",
    "value": "192.0.2.1",
    "ttl": 3600,
    "priority": null,
    "created_at": "2024-01-15T10:30:00Z"
  },
  {
    "uuid": "rec-002",
    "record_type": "MX",
    "name": "@",
    "value": "mail.example.com",
    "ttl": 3600,
    "priority": 10,
    "created_at": "2024-01-15T10:32:00Z"
  }
]
POST /api/v1/dns-zones/{uuid}/records/

Ka waihanga tētahi pūkete DNS i roto i te rohe

Ka tāpiri i tētahi pūkete DNS hou ki tētahi rohe tauwhāiti (ngā ara whakatata).

Tonohia ngā Tawhā Tinana

Parameter Momo E hiahiatia ana Whakamāramatanga
record_type string Āe Record type: A, AAAA, CNAME, MX, TXT, NS, SRV, CAA
name string Āe Record name (@ for root, subdomain, or FQDN)
value string Āe Record value (IP address, hostname, text)
ttl integer No Time to live in seconds (default: 3600)
priority integer For MX/SRV Priority (required for MX and SRV records)

Tauira Tono

cURL
Python
curl -X POST "https://admin.vps.org/api/v1/dns-zones/{uuid}/records/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "record_type": "A",
    "name": "www",
    "value": "192.0.2.1",
    "ttl": 3600
  }'
import requests

url = f"https://admin.vps.org/api/v1/dns-zones/{zone_uuid}/records/"
headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}
data = {
    "record_type": "A",
    "name": "www",
    "value": "192.0.2.1",
    "ttl": 3600
}

response = requests.post(url, headers=headers, json=data)
print(response.json())

Ngā Waehere Tūnga Urupare

201 DNS record created successfully
400 Bad Request - Invalid parameters or validation error (e.g., MX record missing priority)
GET PUT PATCH DELETE /api/v1/dns-records/{uuid}/

Manawa ngā pūkete DNS (Tiaki hāngai)

Ko ngā mahi CRUD katoa i runga i ngā pūkete DNS takitahi mā te whakamahi i te pūkete UUID.

He mahi wātea

Parameter (nā te GET /api/v1/dns-records/)

Parameter Momo Whakamāramatanga
zone string Filter records by zone UUID
record_type string Filter by record type (A, AAAA, MX, etc.)

Hei tauira: Whakahou i te TTL o tētahi pūkete

curl -X PATCH "https://admin.vps.org/api/v1/dns-records/{rec-uuid}/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"ttl": 1800}'

Supported DNS Record Types

Momo Purpose Example Value Priority Required
A Maps domain to IPv4 address 192.0.2.1 Kāore
AAAA Maps domain to IPv6 address 2001:0db8::1 Kāore
CNAME Creates alias to another domain example.com Kāore
MX Mail server for domain mail.example.com Āe
TXT Text record (SPF, DKIM, verification) v=spf1 include:_spf.google.com ~all Kāore
NS Nameserver delegation ns1.example.com Kāore
SRV Service location record 10 5060 sip.example.com Āe
CAA Certificate authority authorization 0 issue "letsencrypt.org" Kāore

Ko nga mahi pai rawa

Whakarekētanga

Kāhua noa iho

Haumarutanga

Ka whakamātautia te hapa

He hapa noa iho

Waehere Tūnga He hapa Whakaroatanga
400 Ko te ingoa rohe kāore i te tika Mā te whakaū i te rohe e whai ana i ngā tikanga ingoa DNS
400 E hiahiatia ana e te pūkete MX te āhuahira Kei roto priority āpure mō ngā pūkete MX me SRV
401 Ko te tohu API kāore i te tika Ka tirohia te hanga tohu (me tīmata ki vps_)
403 Kāore te whakaaetanga Ka whakaputaina he tohu hōu me te hiahiatia dns:* Whakawhiwhinga
404 Kāore i kitea te rohe/whakaatu Whakamātautau i te UUID me te whakarite he rawa e noho ana ki tōna pūnaha

Hei tauira, he whakautu hapa

{
  "detail": "MX records require a priority value",
  "error_code": "validation_error",
  "field": "priority"
}

Ka whakamātautau ngā huringa DNS

Whakamātautau i te whakawhānuitanga o te pūkete

# Query A record
dig example.com A

# Query specific nameserver
dig @ns1.vps.org example.com

# Query MX records
dig example.com MX

# Check all records
dig example.com ANY

Mā te whakamahi i ngā utauta paetata