Files
doc-exports/docs/cfw/api-ref/ListDnsServers.html
qiaoli 2ced5c725f CFW API 20250123 version
Reviewed-by: Gladkov, Maksim <mgladkov@noreply.gitea.eco.tsi-dev.otc-service.com>
Co-authored-by: qiaoli <qiaoli@huawei.com>
Co-committed-by: qiaoli <qiaoli@huawei.com>
2025-02-18 12:17:50 +00:00

13 KiB

Querying the DNS Server List

Function

This API is used to query the DNS server list.

URI

GET /v1/{project_id}/dns/servers

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID, which can be obtained by calling an API or from the console. For details, see Obtaining a Project ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

limit

No

Integer

Number of records displayed on each page. The value ranges from 1 to 1024.

offset

No

Integer

Offset, which specifies the start position of the record to be returned. The value must be a number no less than 0. The default value is 0.

fw_instance_id

No

String

Firewall ID, which can be obtained by referring to Obtaining a Firewall ID.

enterprise_project_id

No

String

Enterprise project ID, which is the ID of a project planned based on organizations. You can obtain the enterprise project ID by referring to Obtaining an Enterprise Project ID. If the enterprise project function is not enabled, the value is 0.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. You can obtain the token by referring to Obtaining a User Token.

Content-Type

Yes

String

Content type. It can only be set to application/json.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

data

Array of DnsServersResponseDTO objects

DNS server list.

total

Integer

Total number of DNS servers.

Table 5 DnsServersResponseDTO

Parameter

Type

Description

id

Integer

Domain name server ID.

is_applied

Integer

Whether the DNS server is applied: 0 (no), 1 (yes).

is_customized

Integer

Whether the DNS server is user-defined: 0 (no), 1 (yes).

server_ip

String

DNS server IP address.

health_check_domain_name

String

Health check domain name.

Example Requests

Obtain the DNS server list of project 2349ba469daf4b7daf268bb0261d18b0.

https://{Endpoint}/v1/2349ba469daf4b7daf268bb0261d18b0/dns/servers?fw_instance_id=80e0f2df-24fd-49c2-8398-11f9a0299b3e

Example Responses

Status code: 200

Response to the request for obtaining DNS servers.

{
  "data" : [ {
    "health_check_domain_name" : "sslstatic.xiaoyusan.com",
    "id" : 20165,
    "is_applied" : 0,
    "is_customized" : 1,
    "server_ip" : "0.0.0.0"
  }, {
    "health_check_domain_name" : "sslstatic.xiaoyusan.com",
    "id" : 14190,
    "is_applied" : 1,
    "is_customized" : 0,
    "server_ip" : "100.79.1.240"
  } ],
  "total" : 2
}

Status Codes

Status Code

Description

200

Response to the request for obtaining DNS servers.

401

Unauthorized

403

Forbidden

404

Not Found

500

Internal Server Error

Error Codes

See Error Codes.