The Zinc API
Zinc is basically an API and here is how you can manage its policies, zones and records.
You are encouraged to install django-rest-swagger
, run zinc locally and explore the API at
http://localhost:8080/swagger
Policies
Policies are read only trough the API. You can define them in the admin.
Policy listing
GET /policies HTTP/1.1
Policy detail
Example:
GET /policies/{id} HTTP/1.1
GET /policies/344b7bee-da33-4234-b645-805cc26adab0 HTTP/1.1
Content-Type: application/json
{
"id": "344b7bee-da33-4234-b645-805cc26adab0",
"name": "policy-one",
"members": [
{
"id": "6bcb4e77-04dc-45f7-bebb-a2fcfadd7669",
"region": "us-east-1",
"ip": "192.0.2.11",
"weight": 10,
"enabled": true
},
{
"id": "4f83d47f-af0c-4fa7-80c8-710cb32e4928",
"region": "us-west-1",
"ip": "192.0.2.11",
"weight": 10,
"enabled": true
}
],
"url": "https://zinc.stage.presslabs.net/policies/344b7bee-da33-4234-b645-805cc26adab0"
}
Zones
Zone listing
GET /zones/ HTTP/1.1
Zone creation
POST /zones/ HTTP/1.1
Args:
Argument | Required | Default | Description |
---|---|---|---|
root |
required | - | The domain name of this zone. Trailing dot is optional. |
Returns the newly created zone object.
Delete a zone
DELETE /zones/{zone_id}/ HTTP/1.1
Zone detail
GET /zones/{zone_id} HTTP/1.1
Example:
GET /zones/102 HTTP/1.1
Content-Type: application/json
{
"root": "zinc.example.presslabs.net.",
"url": "https://zinc.stage.presslabs.net/zones/102",
"records_url": "https://zinc.stage.presslabs.net/zones/102/records",
"records": [
{
"name": "@",
"fqdn": "zinc.example.presslabs.net.",
"type": "NS",
"values": [
"ns-389.awsdns-48.com.",
"ns-1596.awsdns-07.co.uk.",
"ns-1008.awsdns-62.net.",
"ns-1294.awsdns-33.org."
],
"ttl": 172800,
"dirty": false,
"id": "Z6k504rwKzbamNZ9ZmY5lvkoOJGDW0",
"url": "https://zinc.stage.presslabs.net/zones/102/records/Z6k504rwKzbamNZ9ZmY5lvkoOJGDW0",
"managed": true
},
{
"name": "@",
"fqdn": "zinc.example.presslabs.net.",
"type": "SOA",
"values": [
"ns-389.awsdns-48.com. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400"
],
"ttl": 900,
"dirty": false,
"id": "Z6k504rwKzbamNZ6Z7doJ0yg98j9zA",
"url": "https://zinc.stage.presslabs.net/zones/102/records/Z6k504rwKzbamNZ6Z7doJ0yg98j9zA",
"managed": true
}
],
"route53_id": "Z8QRF09VVGAC6",
"dirty": false,
"ns_propagated": false
}
Records
List records in a zone
GET /zones/{zone_id}/records HTTP/1.1
Example:
GET /zones/102/records HTTP/1.1
Content-Type: application/json
[
{
"name": "@",
"fqdn": "zinc.example.presslabs.net.",
"type": "NS",
"values": [
"ns-389.awsdns-48.com.",
"ns-1596.awsdns-07.co.uk.",
"ns-1008.awsdns-62.net.",
"ns-1294.awsdns-33.org."
],
"ttl": 172800,
"dirty": false,
"id": "Z6k504rwKzbamNZ9ZmY5lvkoOJGDW0",
"url": "https://zinc.stage.presslabs.net/zones/102/records/Z6k504rwKzbamNZ9ZmY5lvkoOJGDW0",
"managed": true
},
{
"name": "@",
"fqdn": "zinc.example.presslabs.net.",
"type": "SOA",
"values": [
"ns-389.awsdns-48.com. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400"
],
"ttl": 900,
"dirty": false,
"id": "Z6k504rwKzbamNZ6Z7doJ0yg98j9zA",
"url": "https://zinc.stage.presslabs.net/zones/102/records/Z6k504rwKzbamNZ6Z7doJ0yg98j9zA",
"managed": true
}
]
Create a record
POST /zones/{zone_id}/records HTTP/1.1
Args:
Argument | Required | Default | Description |
---|---|---|---|
name |
required | - | The domain name (without the zone root). |
type |
required | - | The record type. Must be either POLICY_ROUTED or a valid record type. |
values |
required | - | List of values. Should be one IP for A, MX records, a policy id for POLICY_ROUTED, one or more domain names for NS records. |
ttl |
optional | 300 | The TTL for DNS. |
Delete a record
DELETE /zones/{zone_id}/records/{record_id} HTTP/1.1
Record detail
GET /zones/{zone_id}/records/{record_id} HTTP/1.1
Example:
GET /zones/102/records/Z6k504rwKzbamNZ1ZxLxRR4BKly04J HTTP/1.1
Content-Type: application/json
{
"name": "www",
"fqdn": "www.zinc.example.presslabs.net.",
"type": "POLICY_ROUTED",
"values": [
"344b7bee-da33-4234-b645-805cc26adab0"
],
"ttl": null,
"dirty": false,
"id": "Z6k504rwKzbamNZ1ZxLxRR4BKly04J",
"url": "https://zinc.stage.presslabs.net/zones/102/records/Z6k504rwKzbamNZ1ZxLxRR4BKly04J",
"managed": false
}
Update an existing record
PATCH /zones/{zone_id}/records/{record_id} HTTP/1.1
The type and name can’t be changed. Missing attributes don’t change.
Argument | Required | Default | Description |
---|---|---|---|
values |
optional | - | List of values. Should be one IP for A, MX records, a policy id for POLICY_ROUTED, one or more domain names for NS records. |
ttl |
optional | - | The TTL for DNS. |