Public DNS

DNS

  • API Reference
    • API function release records
    • API Service Domain Name
    • Appendix
    • Common Headers and Error Responses
    • General Description
    • Interface Overview
    • Overview
    • Private DNS Related Interfaces
      • Add resolution record
      • Associate VPC
      • Create a PrivateZone
      • Delete PrivateZone
      • Delete resolution record
      • Disassociate VPC
      • Modify resolution record
      • Query details of a PrivateZone
      • Query PrivateZone list
      • Query resolution record list
      • Set Resolution Record Status
    • Public DNS Related Interfaces
      • Domain Name Related Interfaces
      • Line Group Related Interfaces
      • Resolution Records Related Interfaces
  • FAQs
    • General FAQs
  • Function Release Records
  • Operation guide
    • Identity and access management
    • Local DNS service
      • Add Private Zone
      • Add resolution record
      • Associate VPC
      • Delete Private Zone
      • Resolver
    • Public DNS service
      • Add domain name
      • Add resolution
      • Enable Resolution Service
      • Line Grouping Function
      • Manage Resolution
      • Resolution Line Selection
      • Upgrade Domain Name to Enterprise Edition Operation Guide
    • Resolution Logging Management
  • Product Description
    • Application scenarios
    • Product advantages
    • Product functions
    • Product overview
    • Usage restrictions
  • Product pricing
  • Quick Start
    • Activate Service
    • Use Resolution Service
  • SDK
    • Golang-SDK
      • Exception handling
      • Initialization
      • Install the SDK Package
      • Overview
      • Private DNS
      • Version history
    • Java-SDK
      • Install the SDK Package
      • Overview
      • Private DNS
      • Public DNS
      • Version history
    • Python-SDK
      • Initialization
      • Install the SDK Package
      • Overview
      • Private DNS
      • Public DNS
      • Version history
  • Service Level Agreement (SLA)
    • Internal DNS Service Level Agreement SLA
    • Public DNS Service Level Agreement SLA
  • Typical Practices
    • Implement URL Forwarding via Nginx
    • Local IDC Interconnection with Cloud DNS Service via Resolver
    • Quickly Set Up Private Domain Name Resolution Service Using Terraform
All documents
menu
No results found, please re-enter

DNS

  • API Reference
    • API function release records
    • API Service Domain Name
    • Appendix
    • Common Headers and Error Responses
    • General Description
    • Interface Overview
    • Overview
    • Private DNS Related Interfaces
      • Add resolution record
      • Associate VPC
      • Create a PrivateZone
      • Delete PrivateZone
      • Delete resolution record
      • Disassociate VPC
      • Modify resolution record
      • Query details of a PrivateZone
      • Query PrivateZone list
      • Query resolution record list
      • Set Resolution Record Status
    • Public DNS Related Interfaces
      • Domain Name Related Interfaces
      • Line Group Related Interfaces
      • Resolution Records Related Interfaces
  • FAQs
    • General FAQs
  • Function Release Records
  • Operation guide
    • Identity and access management
    • Local DNS service
      • Add Private Zone
      • Add resolution record
      • Associate VPC
      • Delete Private Zone
      • Resolver
    • Public DNS service
      • Add domain name
      • Add resolution
      • Enable Resolution Service
      • Line Grouping Function
      • Manage Resolution
      • Resolution Line Selection
      • Upgrade Domain Name to Enterprise Edition Operation Guide
    • Resolution Logging Management
  • Product Description
    • Application scenarios
    • Product advantages
    • Product functions
    • Product overview
    • Usage restrictions
  • Product pricing
  • Quick Start
    • Activate Service
    • Use Resolution Service
  • SDK
    • Golang-SDK
      • Exception handling
      • Initialization
      • Install the SDK Package
      • Overview
      • Private DNS
      • Version history
    • Java-SDK
      • Install the SDK Package
      • Overview
      • Private DNS
      • Public DNS
      • Version history
    • Python-SDK
      • Initialization
      • Install the SDK Package
      • Overview
      • Private DNS
      • Public DNS
      • Version history
  • Service Level Agreement (SLA)
    • Internal DNS Service Level Agreement SLA
    • Public DNS Service Level Agreement SLA
  • Typical Practices
    • Implement URL Forwarding via Nginx
    • Local IDC Interconnection with Cloud DNS Service via Resolver
    • Quickly Set Up Private Domain Name Resolution Service Using Terraform
  • Document center
  • arrow
  • DNS
  • arrow
  • SDK
  • arrow
  • Java-SDK
  • arrow
  • Public DNS
Table of contents on this page
  • Retrieve Endpoint
  • Retrieve AK/SK
  • Create a new DnsClient
  • Add domain name
  • Query domain name list
  • Delete domain name
  • Purchase a paid domain name
  • Upgrade a free domain name to a discount domain name
  • Renew domain name
  • Add resolution record
  • Query resolution record list
  • Modify resolution record
  • Enable resolution record
  • Disable resolution record list
  • Delete resolution record
  • Add line group
  • Update line group
  • Query line group list
  • Delete line group
  • Appendix

Public DNS

Updated at:2025-11-11

Retrieve Endpoint

Before configuring the endpoint for SDK usage, please refer to the developer guide section on DNS Service Domain Name to understand endpoint-related concepts.

Note: DNS API supports both HTTP and HTTPS calling methods. To enhance data security, it is recommended to call via HTTPS.

Retrieve AK/SK

To use Baidu AI Cloud DNS, you must have a valid AK (Access Key ID) and SK (Secret Access Key) for signature verification. AK/SK are system-generated strings used to identify users and authorize service access. You can obtain and understand your AK/SK information by following these steps:

  1. Register a Baidu AI Cloud account
  2. Create AK/SK

Create a new DnsClient

DnsClient serves as the client for public DNS services, providing developers with a range of methods to interact with DNS services. When creating a DnsClient, first configure a BceClientConfiguration-type config instance using endpoint, AK and SK, and then use the config instance to configure the DnsClient. The specific configuration method is as follows:

Plain Text
1static final String ENDPOINT = "";
2static final String AK = "";
3static final String SK = "";
4BceClientConfiguration config = new BceClientConfiguration();
5config.setCredentials(new DefaultBceCredentials(AK, SK));
6config.setEndpoint(ENDPOINT);
7DnsClient dnsClient = new DnsClient(config);

Add domain name

Function declaration

Java
1public void createZone(CreateZoneRequest body, String clientToken) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Adding a Domain Name

Response value

  • Operation succeeded

None

  • Operation failed

For response exception list of operation failure, refer to the Exception List.

Code example

For specific code examples, please refer to: ExampleCreateZone.java

Query domain name list

Function declaration

Java
1public ListZoneResponse listZone(String name, String marker, Integer maxKeys) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Querying Domain Name List

Response value

  • Operation succeeded
Plain Text
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3    "nextMarker": "5678",
4    "marker": "1234",
5    "maxKeys": 1000,
6    "isTruncated": true,
7    "zones": [
8        {
9            "id": "1234",
10			"name": "baidu.com",
11            "status": "running",
12			"productVersion": "free",
13			"createTime": "2022-04-27 20:19:58",
14			"expireTime": "2023-04-27 20:19:58",
15			"tags": [
16				{
17 "tagKey": "Default project",
18					"tagValue": ""
19				}
20			]
21       }
22    ]
23}
  • Operation failed

For response exception list of operation failure, refer to the Exception List.

Code example

For specific code examples, refer to ExampleListZone.java

Delete domain name

Function declaration

Java
1public void deleteZone(String zoneName, String clientToken) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Deleting a Domain Name

Response value

  • Operation succeeded

None

  • Operation failed

For response exception list of operation failure, refer to the Exception List.

Code example

For specific code examples, please refer to: ExampleDeleteZone.java

Purchase a paid domain name

Function declaration

Java
1public void createPaidZone(CreatePaidZoneRequest body, String clientToken) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Purchasing Paid Domain Names

Response value

  • Operation succeeded

None

  • Operation failed

For response exception list of operation failure, refer to the Exception List.

Code example

For specific code examples, please refer to: ExampleCreatePaidZone.java

Upgrade a free domain name to a discount domain name

Function declaration

Java
1public void upgradeZone(UpgradeZoneRequest body, String clientToken) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Upgrading Free Domain Name to Discount Domain Name

Response value

  • Operation succeeded

None

  • Operation failed

For response exception list of operation failure, refer to the Exception List.

Code example

For specific code examples, please refer to: ExampleUpgradeZone.java

Renew domain name

Function declaration

Java
1public void renewZone(String name, RenewZoneRequest body, String clientToken) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Domain Name Renewal

Response value

  • Operation succeeded

None

  • Operation failed

For response exception list of operation failure, refer to the Exception List.

Code example

For specific code examples, please refer to: ExampleRenewZone.java

Add resolution record

Function declaration

Java
1public void createRecord(String zoneName, CreateRecordRequest body, String clientToken) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Adding Resolution Records

Response value

  • Operation succeeded

None

  • Operation failed

For response exception list of operation failure, refer to the Exception List.

Code example

For specific code examples, please refer to: ExampleAddRecordOnZone.java

Query resolution record list

Function declaration

Java
1public ListRecordResponse listRecord(String zoneName, String rr, String id, String marker, Integer maxKeys) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Querying Resolution Record List

Response value

  • Operation succeeded
Plain Text
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3	"nextMarker": "5678",
4    "marker": "1234",
5    "maxKeys": 1000,
6    "isTruncated": true,
7    "records": [
8		{
9			"id":"1234",
10			"rr":"www",
11			"status":"running",
12			"type":"A",
13			"value":"192.168.1.1",
14			"ttl":300,
15			"line":default,
16			"description":"desc"
17		}
18    ]
19}
  • Operation failed

For response exception list of operation failure, refer to the Exception List.

Code example

For specific code examples, please refer to: ExampleListRecordOfZone.java

Modify resolution record

Function declaration

Java
1public void updateRecord(String zoneName, String recordId, UpdateRecordRequest body, String clientToken) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Modifying Resolution Records

Response value

  • Operation succeeded

None

  • Operation failed

For response exception list of operation failure, refer to the Exception List.

Code example

For specific code examples, please refer to: ExampleUpdateRecordOfZone.java

Enable resolution record

Function declaration

Java
1public void updateRecordEnable(String zoneName, String recordId, String clientToken) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Modifying Resolution Record Status

Response value

  • Operation succeeded

None

  • Operation failed

For response exception list of operation failure, refer to the Exception List.

Code example

For specific code examples, please refer to: ExampleEnableRecordOfZone.java

Disable resolution record list

Function declaration

Java
1public void updateRecordDisable(String zoneName, String recordId, String clientToken) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Modifying Resolution Record Status

Response value

  • Operation succeeded

None

  • Operation failed

For response exception list of operation failure, refer to the Exception List.

Code example

For specific code examples, please refer to: ExampleDisableRecordOfZone.java

Delete resolution record

Function declaration

Java
1public void deleteRecord(String zoneName, String recordId, String clientToken) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Deleting Resolution Records

Response value

  • Operation succeeded

None

  • Operation failed

For response exception list of operation failure, refer to the Exception List.

Code example

For specific code examples, please refer to: ExampleDeleteRecordOfZone.java

Add line group

Function declaration

Java
1public void addLineGroup(AddLineGroupRequest body, String clientToken) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Adding a Line Group

Response value

  • Operation succeeded

None

  • Operation failed

For response exception list of operation failure, refer to the Exception List.

Code example

For specific code examples, please refer to: ExampleAddLineGroup.java

Update line group

Function declaration

Java
1public void updateLineGroup(String lineId, UpdateLineGroupRequest body, String clientToken) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation: Request Parameters for Updating a Line Group

Response value

  • Operation succeeded

None

  • Operation failed

For response exception list of operation failure, refer to the Exception List.

Code example

For specific code examples, please refer to: ExampleUpdateLineGroup.java

Query line group list

Function declaration

Java
1public ListLineGroupResponse listLineGroup(String marker, Integer maxKeys) {
2    ......
3}

Parameter meaning

Refer to OpenAPI documentation: Request Parameters for Querying Line Group List

Response value

  • Operation succeeded
Plain Text
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3    "marker": "1234",
4    "isTruncated": true,
5    "nextMarker": "6056",
6    "maxKeys": 1000,
7    "lineList": [
8        {
9            "id": "6055",
10            "name": "abc",
11            "lines": ["yunnan.ct","sichuan.cmnet"],
12            "relatedZoneCount": 0,
13            "relatedRecordCount": 0
14        }
15    ]
16}
  • Operation failed

For response exception list of operation failure, refer to the Exception List.

Code example

For specific code examples, refer to ExampleListLineGroup.java

Delete line group

Function declaration

Java
1public void deleteLineGroup(String lineId, String clientToken) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation: Request Parameters for Deleting a Line Group

Response value

  • Operation succeeded

None

  • Operation failed

For response exception list of operation failure, refer to the Exception List.

Code example

For specific code examples, please refer to: ExampleDeleteLineGroup.java

Appendix

Public response information in Metadata format

Plain Text
1 {
2      "bceRequestId":"f5f0821d-45fe-439b-bbf4-fc48b639f84a",
3      "contentLength":28,
4      "contentType":"application/json;charset=UTF-8",
5      "date":1701917695000,
6      "server":"openresty/1.15.8.1"
7 }

Previous
Private DNS
Next
Version history