• Domain Name Service

dns
  1. Help Center
  2. Domain Name Service
  3. API Reference
  4. API Description
  5. Record Set Management
  6. Querying Record Sets in a Zone

Querying Record Sets in a Zone

Function

Query all record sets in a specified zone.

URI

GET /v2/zones/{zone_id}/recordsets?limit={limit}&marker={marker}&sort_key={sort_key}&sort_dir={sort_dir}

For details, see Table 1.
Table 1 Parameters in the URI

Parameter

Mandatory

Type

Description

zone_id

Yes

string

Zone ID

marker

No

string

Start resource ID of pagination query

If the parameter is left blank, only resources on the first page are queried.

limit

No

string

  • Number of resources returned on each page
  • Value range: 0–500

    Commonly used values are 10, 20, and 50.

sort_key

No

string

Sorting condition of the record set list

The value can be:

  • name: domain name
  • type: record set type

sort_dir

No

string

Sorting order of the record set list

The value can be:

  • desc: descending order
  • asc: ascending order

Request

None

Response

  • Parameter description
    Table 2 Parameters in the response

    Parameter

    Type

    Description

    recordsets

    List data structure

    Record set list object

    metadata

    object

    Number of resources that meet the filter condition

    Table 3 describes parameters under the recordsets field, and Table 4 describes the parameter under the metadata field.
    Table 3 Description of the recordsets field

    Parameter

    Type

    Description

    id

    string

    Record set ID

    name

    string

    Record set name

    description

    string

    Record set description

    zone_id

    string

    Zone ID of the record set

    zone_name

    string

    Zone name of the record set

    type

    string

    Record set type

    The value can be A, AAAA, MX, CNAME, TXT, NS (only in public zones), SRV, PTR (only in private zones), and CAA (only in public zones).

    ttl

    int

    Caching period of a domain name (in seconds)

    A longer caching period makes a change on the authoritative DNS server take longer time to be synchronized to other DNS servers.

    records

    List<string>

    Domain name resolution result

    create_at

    string

    Time when the record set was created

    update_at

    string

    Time when the record set was updated

    status

    enum

    Resource status

    The value can be PENDING_CREATE, ACTIVE, PENDING_UPDATE, PENDING_DELETE, or ERROR.

    default

    boolean

    Whether the record set is created by default

    A default record set cannot be deleted.

    project_id

    string

    Project ID of the record set

    links

    object

    Link of the current resource or other related resources

    When a response is broken into pages, a next link is provided to retrieve all results.

    Table 4 Description of the metadata field

    Parameter

    Type

    Description

    total_count

    int

    Total number of resources

  • Example response
    {
        "links": {
            "self": "https://Endpoint/v2/recordsets?limit=11&marker=&name=&status=&zone_id=2c9eb155587194ec01587224c9f90149"
        },
        "recordsets": [
            {
                "id": "2c9eb155587194ec01587224c9f9014a",
                "name": "example.com.",
                "type": "SOA",
                "ttl": 300,
                "records": [
                    "ns1.hotrot.de. xx.example.com. (1 7200 900 1209600 300)"
                ],
                "status": "ACTIVE",
                "links": {
                    "self": "https://Endpoint/v2/zones/2c9eb155587194ec01587224c9f90149/recordsets/2c9eb155587194ec01587224c9f9014a"
                },
                "zone_id": "2c9eb155587194ec01587224c9f90149",
                "zone_name": "example.com.",
                "create_at": "2016-11-17T11:56:03.439",
                "update_at": "2016-11-17T12:56:03.827",
                "default": true,
                "project_id": "e55c6f3dc4e34c9f86353b664ae0e70c"
            },
            {
                "id": "2c9eb155587194ec01587224c9f9014c",
                "name": "example.com.",
                "type": "NS",
                "ttl": 172800,
                "records": [
                    "ns2.hotrot.de.",
                    "ns1.hotrot.de."
                ],
                "status": "ACTIVE",
                "links": {
                    "self": "https://Endpoint/v2/zones/2c9eb155587194ec01587224c9f90149/recordsets/2c9eb155587194ec01587224c9f9014c"
                },
                "zone_id": "2c9eb155587194ec01587224c9f90149",
                "zone_name": "example.com.",
                "create_at": "2016-11-17T11:56:03.439",
                "update_at": "2016-11-17T12:56:03.827",
                "default": true,
                "project_id": "e55c6f3dc4e34c9f86353b664ae0e70c"
            },
            {
                "id": "2c9eb155587228570158722b6ac30007",
                "name": "www.example.com.",
                "description": "This is an example record set.",
                "type": "A",
                "ttl": 300,
                "records": [
                    "192.168.10.2",
                    "192.168.10.1"
                ],
                "status": "PENDING_CREATE",
                "links": {
                    "self": "https://Endpoint/v2/zones/2c9eb155587194ec01587224c9f90149/recordsets/2c9eb155587228570158722b6ac30007"
                },
                "zone_id": "2c9eb155587194ec01587224c9f90149",
                "zone_name": "example.com.",
                "create_at": "2016-11-17T12:03:17.827",
                "update_at": "2016-11-17T12:56:03.827",
                "default": false,
                "project_id": "e55c6f3dc4e34c9f86353b664ae0e70c"
            }
        ],
        "metadata": {
            "total_count": 3
        }
    }

Returned Value

See General Request Return Code.