Private 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
  • Private DNS
Table of contents on this page
  • Retrieve Endpoint
  • Retrieve AK/SK
  • Create a new LdClient
  • Create a PrivateZone
  • Delete PrivateZone
  • Query PrivateZone list
  • Query details of a PrivateZone
  • Associate VPC
  • Disassociate VPC
  • Add resolution record
  • Modify resolution record
  • Delete resolution record
  • Query resolution record list
  • Enable resolution record
  • Disable resolution record
  • Appendix

Private 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 LdClient

LdClient serves as the client for local DNS services, providing developers with a range of methods to interact with DNS services. When creating an LdClient, 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);
7LdClient ldClient = new LdClient(config);

Create a PrivateZone

Function declaration

Java
1public CreatePrivateZoneResponse createPrivateZone(CreatePrivateZoneRequest body, String clientToken) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Creating a PrivateZone

Response value

  • Operation succeeded
Plain Text
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3    "zoneId":"zone-jkgdns3h"
4}
  • Operation failed

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

Code example

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

Delete PrivateZone

Function declaration

Java
1public void deletePrivateZone(String zoneId, String clientToken) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Deleting a PrivateZone

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: ExampleDeletePrivateZone.java

Query PrivateZone list

Function declaration

Java
1public ListPrivateZoneResponse listPrivateZone(String marker, Integer maxKeys) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Querying a PrivateZone List

Response value

  • Operation succeeded
Plain Text
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3    "nextMarker": "zone-xktdeMSf",
4    "marker": "zone-IyWRnII7",
5    "maxKeys": 1,
6    "isTruncated": true,
7    "zones": [
8        {
9            "zoneId": "zone-IyWRnII7",
10            "zoneName": "baidu.com",
11            "recordCount": 2,
12            "createTime": "2018-12-26 20:30:45",
13            "updateTime": "2018-12-28 21:35:40"
14        }
15    ]
16}
  • Operation failed

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

Code example

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

Query details of a PrivateZone

Function declaration

Java
1public GetPrivateZoneResponse getPrivateZone(String zoneId) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Querying a PrivateZone

Response value

  • Operation succeeded
Plain Text
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3    "zoneId": "zone-xktdeMSf",
4    "zoneName": "baidu1.com",
5    "recordCount": 2,
6    "createTime": "2018-12-26 20:30:45",
7    "updateTime": "2018-12-28 21:35:40"
8    "bindVpcs": [
9        {
10            "vpcId": "vpc-jikh8hds",
11            "vpcName": "vpcTest",
12            "vpcRegion": "bj"
13        }
14    ]
15}
  • Operation failed

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

Code example

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

Associate VPC

Function declaration

Java
1public void bindVpc(String zoneId, BindVpcRequest body, String clientToken) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Associating a VPC

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: ExampleBindVpcOnPrivateZone.java

Disassociate VPC

Function declaration

Java
1public void unbindVpc(String zoneId, UnbindVpcRequest body, String clientToken) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Disassociating VPC

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: ExampleUnBindVpcFromPrivateZone.java

Add resolution record

Function declaration

Java
1public AddRecordResponse addRecord(String zoneId, AddRecordRequest body, String clientToken) {
2    ......
3}

Parameter meaning

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

Response value

  • Operation succeeded
Plain Text
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3    "recordId":"rc-jih8hd5s"
4}
  • Operation failed

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

Code example

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

Modify resolution record

Function declaration

Java
1public void updateRecord(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: ExampleUpdateRecordOnPrivateZone.java

Delete resolution record

Function declaration

Java
1public void deleteRecord(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: ExampleDeleteRecordOnPrivateZone.java

Query resolution record list

Function declaration

Java
1public ListRecordResponse listRecord(String zoneId) {
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": "rc-Iy8p6arqenI7",
4    "marker": "rc-ik9p9zq6u5ry",
5    "maxKeys": 1,
6    "isTruncated": true,
7    "records": [
8        {
9            "recordId": "rc-djkf8hf9",
10            "rr": "ip",
11            "value": "192.184.18.233",
12            "status": "enable",
13            "type": "A",
14            "ttl": 60,
15            "description": "desc"
16        }
17    ]
18}
  • Operation failed

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

Code example

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

Enable resolution record

Function declaration

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

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Enabling 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: ExampleEnableRecordOnPrivateZone.java

Disable resolution record

Function declaration

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

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Disabling 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: ExampleDisableRecordOnPrivateZone.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
Overview
Next
Public DNS