Updated on 2025-08-19 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 search will work. This parameter is left blank by default.

region

No

String

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

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

The user token.

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

For details about how to obtain a user token, seeObtaining a User Token.

Constraints

N/A

Range

N/A

Default Value

N/A

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. The value can be public or private. If this parameter is left blank, all types of name servers will be queried.

public indicates name servers of public zones. private indicates name servers of private zones.

region

String

The region ID. When you query name servers of public zones, leave this parameter blank.

ns_records

Array of ns_records objects

Name server list

Table 5 ns_records

Parameter

Type

Description

hostname

String

The host name. When you query name servers of private zones, leave this parameter blank.

address

String

The name server address. When you query name servers of public zones, leave this parameter blank.

priority

Integer

The priority of the name server. Example: If the priority of a name server is set to 1, it is used to resolve domain names in the first priority.

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.