Updated on 2024-03-25 GMT+08:00

Querying Name Servers

Function

This API is used to query name servers.

Calling Method

For details, see Calling APIs.

URI

GET /v2/nameservers

Table 1 Query Parameters

Parameter

Mandatory

Type

Description

type

No

String

Type of the name server.

Value options:

  • public indicates a public name server.

  • private indicates a private name server.

Exact matching will work. It is left blank by default.

region

No

String

Region ID. When you query a public name server, leave this parameter blank. Exact matching will work. It is left blank by default.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. It can be obtained by calling an IAM API. The value of X-Subject-Token in the response header is the user token.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

nameservers

Array of NameServersResp objects

Name server list

Table 4 NameServersResp

Parameter

Type

Description

type

String

Type of the name server.Value options: - public indicates a public name server.- private indicates a private name server.

region

String

Region ID. When you query a public name server, leave this parameter blank.

ns_records

Array of ns_records objects

Name server list

Table 5 ns_records

Parameter

Type

Description

hostname

String

Host name. This parameter is left blank when a private name server is used.

address

String

Address of the name server. When the server is a public name server, this parameter is left blank.

priority

Integer

Priority. If the value of priority is 1, the DNS server is the first one to resolve domain names.

Example Requests

None

Example Responses

Status code: 200

Response to the request for querying the name server list

{
  "nameservers" : [ {
    "region" : null,
    "type" : "public",
    "ns_records" : [ {
      "hostname" : "ns1.huawei.com.",
      "priority" : 1
    }, {
      "hostname" : "ns2.huawei.com.",
      "priority" : 2
    } ]
  }, {
    "region" : "xxx",
    "type" : "private",
    "ns_records" : [ {
      "priority" : 1,
      "address" : "100.125.1.0"
    }, {
      "priority" : 2,
      "address" : "100.125.1.1"
    } ]
  } ]
}

Status Codes

Status Code

Description

200

Response to the request for querying the name server list

Error Codes

See Error Codes.