Domain Name Independent Resolution API - Interface Documentation

DNS API Interface Documentation

Overview

This document describes the interfaces for querying, adding, updating, and deleting DNS records. All interfaces use the GET method and require request signing.

Base URI: https://www.eranet.com

Request Method: GET

Signature Mechanism: Yes (using HMAC-SHA1)

Common Parameters: In addition to interface-specific parameters, each request must include common parameters for signing.

Signature Mechanism

Before calling any interface, all request parameters (including common and interface-specific parameters) must be signed, and the signed result, Signature, must be appended as a parameter to the request.

Signature Steps:

Prepare Common Parameters: Add the following common parameters to the request parameter dictionary:

AccessInstanceID: Your AccessKeyID.

SignatureMethod: Fixed to HMAC-SHA1.

Timestamp: The requested timestamp, formatted as ISO 8601 standard UTC time, e.g., 2023-10-27T06:50:12Z.

SignatureNonce: A unique random number used to prevent replay attacks, at least 8 bits long.

Parameter Sorting and Encoding:

Sort all parameters (including common and interface parameters) in ascending lexicographical order by parameter name.

Perform normalized encoding on the sorted parameters to generate a CanonicalizedQueryString. The encoding rule uses the percentEncode function (replacing “+” with “%20”, “*” with “%2A”, and “%7E” with “~”).

Constructing the Signature String:

Format: StringToSign = “GET&” + percentEncode(“/”) + “&” + percentEncode(CanonicalizedQueryString)

Calculating the Signature:

Using the HMAC-SHA1 algorithm, with your AccessKeySecret as the key, sign StringToSign.

Base64 encode the signature result; the resulting string is the value of the Signature parameter.

Adding a Signature:

Add the calculated Signature value to the final request parameters.

Note: Your provided DnsApiTest.php file already contains a complete signature implementation (sign, percentEncode, sign_string methods), which you can refer to.

Interface List

1. Retrieving a List of Domain Name Resolution Records

Query all DNS resolution records for a specified domain.

Request Path: /api/dns/DescribeRecordIndex

Request Method: GET

Request Parameters:

|Parameter Name|Type|Required|Description|

|—|—|—|—|

|Domain|String|Yes|The domain to query, for example: csbxhk.com.hk|

Request Example:

After adding all the common parameters required for signatures, a complete request URL example is as follows:

Copy

https://www.eranet.com/api/dns/DescribeRecordIndex?AccessInstanceID=113515821&Domain=csbxhk.com.cn&Signature=Calculated Signature Value&SignatureMethod=HMAC-SHA1&SignatureNonce=Random String&Timestamp=2023-10-27T06:50:12Z

2. Add a new DNS record for the specified domain.

This adds a new DNS record for the specified domain.

Request path: /api/dns/AddDomainRecord

Request method: GET

Request parameters:

|Parameter name|Type|Required|Description|

|—|—|—|—|

|Domain|String|Yes|The domain to be added to the record|

|Host|String|Yes|Host record, such as www, @, *, etc.|

|Type|String|Yes|Record type, such as A, hkAME, TXT, etc.|

|Value|String|Yes|Record value, such as IP address or domain|

|Ttl|Integer|Yes|The TTL (Time To Live) value of the record, in seconds|

Request Example:

Copy

http://www.eranet.com/api/dns/AddDomainRecord?AccessInstanceID=113515821&Domain=csbxhk.com.cn&Host=c&Signature=CalculatedSignatureValue&SignatureMethod=HMAC-SHA1&SignatureNonce=RandomString&Ttl=600&Timestamp=2023-10-27T06:50:12Z&Type=A&Value=1.1.1.1

3. Update Domain Name Resolution Records

Updates the settings of the specified domain name resolution record.

Request Path: /api/dns/UpdateDomainRecord

Request Method: GET

Request Parameters:

|Parameter Name|Type|Required|Description|

|—|—|—|—|

|Domain|String|Yes|The domain to which the record belongs|

|Id|String|Yes|The ID of the DNS record to be updated|

|Host|String|Yes|The updated host record|

|Type|String|Yes|Record type, such as A, hkAME, TXT, etc.|

|Value|String|Yes|Record value, such as IP address or domain|

|Ttl|Integer|Yes|The TTL (Time to Live) value of the record, in seconds|

Request Example:

This interface only updates the Host field in the example file.

Copy

https://www.eranet.com/api/dns/UpdateDomainRecord?AccessInstanceID=113515821&Domain=csbxhk.com.cn&Host=w&Id=19367&Signature=CalculatedSignatureValue&SignatureMethod=HMAC-SHA1&SignatureNonce=RandomString&Timestamp=2023-10-27T06:50:12Z

4. Delete Domain Name Resolution Record

Deletes a specified domain name resolution record.

Request Path: /api/dns/DeleteDomainRecord

Request Method: GET

Request Parameters:

|Parameter Name|Type|Required|Description|

|—|—|—|—|

|Domain|String|Yes|The domain to which the record belongs|

|Id|String|Yes|The ID of the DNS record to be deleted|

Request Example:

Copy

https://www.eranet.com/api/dns/DeleteDomainRecord?AccessInstanceID=113515821&Domain=csbxhk.com.cn&Id=19370&Signature=Calculated signature value&SignatureMethod=HMAC-SHA1&SignatureNonce=Random string&Timestamp=2023-10-27T06:50:12Z

Summary of Call Steps

Prepare Parameters: Identify the interface to be called and assemble its specific parameters.

Signing:

a. Add common parameters (AccessInstanceID, SignatureMethod, Timestamp, SignatureNonce).

b. Normalize all parameters (in ascending order of name) to generate the string to be signed.

c. Calculate the signature using your AccessKeySecret via the HMAC-SHA1 algorithm and Base64 encode it.

d. Add the signature value as the Signature parameter to the request.

Send the Request: Use the HTTP GET method, appending all parameters as a query string to the API request path, and send a request to the server.

Important Note: The AccessInstanceID and AccessKeySecret in the file are only examples; please replace them with your own key when actually making the call. The base_uri (http://www.tnet.hk) may also need to be changed depending on the deployment environment.