Updated on 2026-01-07 GMT+08:00

Updating the DNS Server List

Function

This API is used to update the DNS server list.

URI

PUT /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

fw_instance_id

Yes

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.

Table 4 Request body parameters

Parameter

Mandatory

Type

Description

dns_server

Yes

Array of dns_server objects

DNS server list.

health_check_domain_name

No

String

Health check domain name, which can be obtained by calling the API for querying the DNS server list. Find the value in data.health_check_domain_name (The period [.] is used to separate different levels of objects).

Table 5 dns_server

Parameter

Mandatory

Type

Description

server_ip

Yes

String

DNS server IP address, which can be obtained by calling the API for querying the DNS server list. Find the value in data.server_ip (The period [.] is used to separate different levels of objects).

is_customized

Yes

Integer

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

is_applied

Yes

Integer

Whether to apply: 0 (no), 1 (yes).

Response Parameters

Status code: 200

Table 6 Response body parameters

Parameter

Type

Description

data

Array of strings

DNS server list.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Example Requests

Update the settings of the DNS resolver whose project ID is 2349ba469daf4b7daf268bb0261d18b0. Put the default server 8.8.8.8 in use. Stop using the non-default server 192.168.0.2.

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

{
  "dns_server" : [ {
    "server_ip" : "8.8.8.8",
    "is_customized" : 0,
    "is_applied" : 1
  }, {
    "server_ip" : "192.168.0.2",
    "is_customized" : 1,
    "is_applied" : 0
  } ]
}

Example Responses

Status code: 200

Response to the request for updating the DNS server list.

{
  "data" : [ "100.95.150.83", "114.114.114.114", "223.5.5.5", "223.6.6.6", "119.29.29.29", "8.8.8.8", "100.79.1.250", "100.79.1.240" ]
}

Status code: 400

Bad Request

{
  "error_code" : "CFW.00109003",
  "error_msg" : "http to external service response status error"
}

Status Codes

Status Code

Description

200

Response to the request for updating the DNS server list.

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

Internal Server Error

Error Codes

See Error Codes.