DNS

Get a list of DNS applications

Description

Gets the list of DNS applications for the specified paging.

URI

GET /admin-api/dns/

URI Parameters

  • detail

    type: integer

    required: no

    description: Get detailed DNS application information

  • page

    type: integer

    required: no

    description: Results page (default 1)

  • page_size

    type: integer

    required: no

    description: Results page size (default 20)

Example Request

Shell

curl https://{admin-site}/admin-api/dns/?page=1&page_size=20&detail=1

Example Response

Status: 200 OK
{
    "status": 0,
    "data": {
        "meta": {
            "count": 1
        },
        "data": [
            {
                "zone": "test.com",
                "record": [
                    {
                        "is_healthy": true,   // health status
                        "ttl": 5,
                        "type": "A",
                        "_modified_unix": 1614749852.6159,
                        "checker_port": 80,
                        "disabled": false,
                        "checker_fail_times": 3,
                        "id": 1,  // Record ID
                        "enable_checker": true,
                        "sub_domain": "foo",
                        "checker_timeout": 1,
                        "ip": "2.1.1.2",
                        "_created_unix": 1614749491.5138,
                        "line": 0,
                        "unit": "min"
                    }
                ],
                "id": 1,
                "nameserver": [
                    {
                        "ttl": 1,
                        "unit": "day",
                        "id": 1,
                        "domain": "n1.test.com"
                    },
                    {
                        "ttl": 1,
                        "unit": "day",
                        "id": 2,
                        "domain": "n2.test.com"
                    }
                ],
                "creator": 1,   // Creator ID
                "soa_email": "admin.test.com",
                "_created_unix": 1614749488.792,
                "_modified_unix": 1614749490.4672
            }
        ]
    }
}

Get the specified DNS application configuration

Description

Get the specified DNS application configuration.

URI

GET /admin-api/dns/{id}

URI Parameters

  • detail

    type: integer

    required: no

    description: Get detailed DNS application information

Example Request

Shell

curl https://{admin-site}/admin-api/dns/1?detail=1

Example Response

Status: 200 OK
{
    "status": 0,
    "data": {
        "zone": "test.com",
        "record": [
            {
                "is_healthy": true,
                "ttl": 5,
                "type": "A",
                "_modified_unix": 1614749852.6159,
                "checker_port": 80,
                "disabled": false,
                "checker_fail_times": 3,
                "id": 1,
                "enable_checker": true,
                "sub_domain": "foo",
                "checker_timeout": 1,
                "ip": "2.1.1.2",
                "_created_unix": 1614749491.5138,
                "line": 0,
                "unit": "min"
            }
        ],
        "id": 1,
        "nameserver": [
            {
                "ttl": 1,
                "unit": "day",
                "id": 1,
                "domain": "n1.test.com"
            },
            {
                "ttl": 1,
                "unit": "day",
                "id": 2,
                "domain": "n2.test.com"
            }
        ],
        "creator": 1,
        "soa_email": "admin@test.com",
        "_created_unix": 1614749488.792,
        "_modified_unix": 1614825469.4997
    }
}

Create a DNS application

Description

Create a DNS application.

URI

POST /admin-api/dns/

JSON Body Parameters

  • zone

    type: string

    required: yes

    description: DNS zone

  • soa_email

    type: string

    required: no

    description: Mailbox for the SOA record in the response

  • gid

    type: array

    required: no

    description: User groups with access rights

  • nameserver

    type: array

    required: yes

    description: Authoritative Domain Name Servers

Example Request

Shell

curl -X POST https://{admin-site}/admin-api/dns/ -d
'{
    "zone": "openresty.com",
    "nameserver": [
        {
            "domain": "ns1.openresty.com",
            "ttl": 1,
            "unit": "day"
        }
    ],
    "soa_email": "support@openresty.com",
    "gid": [
        2,
        3
    ]
}'

Example Response

Status: 200 OK
{
    "status": 0,
    "data": {
        "id": 3
    }
}

Modify the DNS application

Description

Modify the DNS application.

URI

PUT /admin-api/dns/{id}

JSON Body Parameters

  • zone

    type: string

    required: yes

    description: DNS zone

  • soa_email

    type: string

    required: no

    description: Mailbox for the SOA record in the response

  • gid

    type: array

    required: no

    description: User groups with access rights

  • nameserver

    type: array

    required: yes

    description: Authoritative Domain Name Servers

Example Request

Shell

curl -X PUT https://{admin-site}/admin-api/dns/ -d
'{
    "id": 1,
    "zone": "openresty.com",
    "nameserver": [
        {
            "domain": "ns1.openresty.com",
            "ttl": 1,
            "unit": "day"
        }
    ],
    "soa_email": "support@openresty.com",
    "gid": [
        2,
        3
    ]
}'

Example Response

Status: 200 OK
{
    "status": 0
}

Remove the DNS application

Description

Remove the DNS application.

URI

DELETE /admin-api/dns/{id}

Example Request

Shell

curl -X DELETE https://{admin-site}/admin-api/dns/1

Example Response

Status: 200 OK
{
    "status": 0
}