2 Zones API: How to retrieve a zone

This is a series of articles dedicated to demonstrating how to get acquainted with Openprovider DNS Zones API methods. If you want to go the beginning of this guide, please navigate to the article "Zones API: How to create a zone".

This is a second article in a series in which we are going to cover all the basic operations that can be performed via Openprovider API methods regarding DNS zone management. To get more information about our API in general, please use our documentation portal as your reference.

In the previous article we covered how to create a DNS zone. In this one let's look at how we can retrieve it.

Our API has multiple methods that are responsible for either listing a zone's characteristics or its respective contents(records). First let's look at how to search for a particular zone.

Searching for a zone

For this purpose we're going to use List Zones method. It returns information about an existing DNS zone object.

Entering Geo Fence iconUse endpoint path below. Base URL is determined by both the target environment and API version.
GET {base_url}/dns/zones/

REQUEST VALUES

Name Type Description
limit integer Optional. default value: 100, maximum value: 1000
offset integer Optional.master or slave
name_pattern string Required.
type string Required for master zones
with_records boolean Optional. default value: 0
with_history boolean Optional. default value: 0

REQUEST EXAMPLE

curl -X GET \
'https://api.openprovider.eu/v1beta/dns/zones?name_pattern=domain.com' \
-H 'Authorization: ,Bearer 2831a37fb8*******90b5aac822' \

RESPONSE EXAMPLE

{
"code": 0,
"data": {
"active": 1,
"creation_date": "1328427448",
"dnskey": "",
"id": 1,
"ip": "127.0.0.1",
"is_deleted": false,
"is_shadow": false,
"is_spamexperts_enabled": false,
"modification_date": "1543388225",
"name": "domain.com",
"reseller_id": 1,
"type": "master"
},
"desc": ""
}

RESPONSE VALUES

Name Type Description
type string  
name string  
ip varchar  
creation_date timestamp  
modification_date timestamp  
records   Will be returned if with_records = true
history   Will be returned if with_history = true


Retrieving a zone

Once you you know that the zone in question actually exists, you can retrieve information about it with the help of Get Zone method. This API method is intended to get data about an existing DNS zone object as well as its records.

 Entering Geo Fence iconUse endpoint path below. Base URL is determined by both the target environment and API version.

GET {base_url}/dns/zones/{name}

REQUEST VALUES

Name Type Description
id integer Optional. default value: 100, maximum value: 1000
name string Required.
with_records boolean Optional. default value: 0
with_history boolean Optional. default value: 0
with_dnskey boolean Optional. default value: 0

REQUEST EXAMPLE

curl -X GET \
https://api.openprovider.eu/v1beta/dns/zones/demo-domain.nl \
-H 'Accept: */*' \
-H 'Authorization: ,Bearer b3920befa9*******f838a2191a44f' \

RESPONSE EXAMPLE

{
"data": {
"id": 9146574,
"reseller_id": 204661,
"type": "master",
"name": "demo-domain.nl",
"active": 1,
"creation_date": "2019-06-27 06:22:36",
"modification_date": "2019-06-27 06:22:36"
}
}
In the following article we are going to modify some of the records of the zone and see how it can be then deleted.

 

Was this article helpful?
Additional questions? Submit a request