1 Zones API: How to create a zone
This is a series of articles dedicated to demonstrating how to get acquainted with Openprovider DNS Zones API methods.
This is the first article in a series in which we are going to cover DNS zone creation. To get more information about our API in general, please use our documentation portal as your reference.
In addition to being a domain registrar, Openprovider also offers DNS hosting for which we have an extensive API.
Zones represent the DNS zone for a domain. Each domain usually has a zone, however zones may also exist without a domain. Zones have at least 1 (but oftentimes more) records. All zones represent a combination of system records, which are records that are created automatically by us, such as SOA and NS records, as well as custom records, which are records created by users.
Once you have an Openprovider account you can use the Zones API methods which will allow you to list records for a zone, as well as add, edit, and remove zone records. However, first things first. Let's focus on creating a zone as our starting point.
Once you have decided on the records that your zone should should store (if any), you can use our API endpoint, api.openprovider.eu, to send a request.
POST{base_url}/dns/zones
REQUEST VALUES
| Name | Type | Description |
| domain | string | Required. Name of a zone (domain name) |
| type | string | Required, master or slave |
| master_ip | string | Required when type is slave |
| records | array of data | Required for master zones |
| template_name | string | Optional. |
| is_spamexpert_enabled | boolean | Optional. Enable SpamExperts subscription for a zone |
| secured | boolean | Optional. Enable DNSSEC |
REQUEST EXAMPLE
curl -X POST \
'https://api.openprovider.eu/v1/dns/zones' \
-H 'Authorization: Bearer <your_token>' \
-H 'Content-Type: application/json' \
-d '{
"domain": {
"extension": "nl",
"name": "op-demozone"
},
"type": "master",
"records": [
{
"name": "acmelab0",
"ttl": 900,
"type": "TXT",
"value": "test value 0"
},
{
"name": "acmelab1",
"ttl": 900,
"type": "TXT",
"value": "test value 1"
}
]
}'
RESPONSE EXAMPLE
{
"code": 0,
"desc": "",
"data": {
"success": true
}
}
The 0 code that we received indicates that the zone has been successfully created.
Now let's try to retrieve it from the API to make sure of that and change some of its records.