HTTPDNS provides DNS services through HTTP and HTTPS APIs. The services are accessed directly at IP addresses. Multiple service IPs are available. The following takes the query entry 43.132.55.56
for HTTPS request as an example.
Note:
- Currently, only the HTTP DES encryption method is available (service IP:
43.132.55.55
), while HTTPS and AES encryption methods are not.- After activating HTTPDNS, you need to first add a domain to be resolved in the HTTPDNS console as instructed in Adding a Domain.
- We provide two sample entry IPs:
43.132.55.56
for HTTPS and43.132.55.55
for HTTP.- Use the official SDK preferably. If the SDK cannot be used in special scenarios, you need to directly access the HTTP API. In this case, please submit a ticket to contact us, and we will provide you with multiple service IPs and applicable security suggestions according to your specific use case.
- For considerations of security risks such as service IP attacks, in order to ensure service availability, HTTPDNS provides multiple service IPs at the same time. When an IP is unavailable under abnormal conditions, you can retry with other IPs.
When using the request API https://43.132.55.56/d? + {request parameters}
, you need to use the following configuration information, which can be obtained on the Development Configuration page in the HTTPDNS console:
HTTPS encryption token: The token used to authenticate the DNS request data when you call the HTTPS DNS API https://43.132.55.56
of HTTPDNS.
https://43.132.55.56/d? + {request parameters}
.Parameter | Description | Required | Value | Encryption | Description |
---|---|---|---|---|---|
dn | Queried domain | Yes | Strings | No | It must be a domain added in the HTTPDNS console. For more information, see Adding a Domain. |
token | Flag for using HTTPS | Yes | Integer data | No | For how to get a token, see Configuration Information Description. |
ip | ECS (EDNS-Client-Subnet) value of the DNS request | No | IPv4/IPv6 address value | No | By default, the HTTPDNS server will query the client's egress IP in order to query the IP for the DNS split zone. You can use the `ip=xxx` parameter to specify the split zone's IP address. You can pass in IPv4/IPv6 addresses, which will be automatically identified by the API. |
query | Queried domain returned in the result | No | 1 | No | For single-domain queries, this parameter requires the returned result to carry the queried domain. |
timeout | Timeout period | No | 1000–5000 ms | No | It is the query timeout period, which is 5 seconds by default. Value range: [1000, 5000] ms |
ttl | Specifies whether to return the TTL value in the query result | No | 1 | No | If this parameter is not carried, the TTL value will not be passed by default. Valid value: 1 |
type | Query type | No | [aaaa/AAAA/addrs/ADDRS] | No | Valid values: [aaaa,AAAA,addrs,ADDRS]. The A record will be queried by default. If AAAA/aaaa is set, the AAAA record will be queried; if addrs/ADDRS is set, both the A and AAAA records will be queried. |
clientip | Client IP address returned in the query result | No | 1 | No | Valid value: 1. If this parameter is not carried, the clientip value will not be passed by default. If a value is assigned to this parameter, the address value will be after the | symbol in the returned result. If the ip parameter is carried, the value of the ip parameter will be returned; otherwise, the client IP address will be returned. |
Note:
- The ECS (EDNS-Client-Subnet) protocol adds the IP address of the user requesting DNS in the DNS request packet, based on which the DNS server can return a server IP address for quicker access by the user.
- If you make a query with an HTTPS request method, the transferred data will be protected through encryption because of the TLS channel, so you don't need to encrypt the data passed in.
- For security and authentication reasons, you need to pass in the HTTPS token.
The domain cloud.tencent.com
and token yyyy
are used as an example below.
Note:
- If HTTPDNS does not find the DNS query result, it will return null.
- HTTPDNS has been connected to BGP Anycast to implement multi-region cross-IDC disaster recovery. However, to guarantee a higher service quality, we recommend you use the failover policy for connection.
Sample input:
curl "https://43.132.55.56/d?dn=cloud.tencent.com&token=yyyy"
Decrypted response format:
2.3.3.4;2.3.3.5;2.3.3.6
Format description: Multiple returned query results are separated by semicolon.
Sample input:
curl "https://43.132.55.56/d?dn=cloud.tencent.com&token=yyyy&ttl=1"
Decrypted response format:
2.3.3.4;2.3.3.5;2.3.3.6,120
Format description: Multiple returned query results are separated by semicolon. The record values and TTL value are separated by comma.
Sample input:
curl "https://43.132.55.56/d?dn=cloud.tencent.com&token=yyyy&clientip=1&ip=1.2.3.4&ttl=1"
Decrypted response format:
12.3.3.4;2.3.3.5;2.3.3.6,120|1.2.3.4
Format description: The returned result carries the split zone's IP address separated by '|'. If the "ip=xxx" parameter is not passed in, the egress IP address will be returned; otherwise, the address in the ip
parameter will be returned.
Sample input:
curl "https://43.132.55.56/d?dn=cloud.tencent.com&token=yyyy&clientip=1&ip=1.2.3.4&type=addrs&ttl=1"
Decrypted response format:
2.3.3.4;2.3.3.5;2.3.3.6,120-2402:4e00:0123:4567:0::2345;2403:4e00:0123:4567:0::2346,120|1.2.3.4
Format description: The A record is followed by a hyphen and then the AAAA record.
Sample input:
curl "https://43.132.55.56/d?dn=cloud.tencent.com&token=yyyy&clientip=1&ip=1.2.3.4&query=1&ttl=1"
Decrypted response format:
cloud.tencent.com.:2.3.3.4;2.3.3.5;2.3.3.6,120|1.2.3.4
Format description: The response is in the format of "domain.:result".
Sample input:
curl "https://43.132.55.56/d?dn=cloud.tencent.com,www.qq.com,www.dnspod.cn&token=yyyy&clientip=1&ip=1.2.3.4&ttl=1"
Decrypted response format:
cloud.tencent.com.:2.3.3.4;2.3.3.5;2.3.3.6,120
www.qq.com.:3.3.3.4;3.3.3.5;3.3.3.6,180
www.dnspod.cn.:4.3.3.4;4.3.3.5;4.3.3.6,60|1.2.3.4
Format description: The returned result of multiple domains are separated by line break, with the IP addresses appended at the end of all record values.
Sample input:
curl "https://43.132.55.56/d?dn=cloud.tencent.com&token=yyyy&id=xxx"
Decrypted response format: Empty.
Format description: If there are no records, an empty string will be returned.
Sample input:
curl "https://43.132.55.56/d?dn=cloud.tencent.com&token=yyyy&type=addrs&query=1&ip=1.2.3.4"
Decrypted response format:
cloud.tencent.com|1.2.3.4
Format description: 0 indicates no records.
Sample input:
curl "https://43.132.55.56/d?dn=cloud.tencent.com&token=yyyy&type=addrs&query=1&ip=1.2.3.4"
Decrypted response format:
cloud.tencent.com.:0-0|1.2.3.4
Format description: 0 indicates no records. If a record exists, it will be returned in the result. For example, cloud.tencent.com.:2.3.4.5;3.3.3.3-0|1.2.3.4
indicates that no AAAA records can be found.
Sample input:
curl "https://43.132.55.56/d?dn=cloud.tencent.com,www.qq.com,www.dnspod.cn&token=yyyy&clientip=1&ip=1.2.3.4&ttl=1"
Decrypted response format:
cloud.tencent.com.:0
www.qq.com.:3.3.3.4;3.3.3.5;3.3.3.6,180
www.dnspod.cn.:4.3.3.4;4.3.3.5;4.3.3.6,60|1.2.3.4
Format description: For domains about which no data is found, 0 will be returned. If a record exists, it will be returned in the result.
The following are the HTTP status codes related to the business logic of the APIs.
Status Code | Description |
---|---|
200 OK | If the API is called correctly, a 200 status code will be returned regardless of whether the query is successful. |
404 Not Found | The API does not exist, or the URL actually accesses a resource that does not exist. |
429 Too Many Requests | The access requests are too frequent and exceed the limit. |
501 Not Implemented | A request method other than "GET" or "POST" is used. |
Was this page helpful?