This topic describes how to add custom resolution parameters to a client SDK or an HTTP API operation.
Add custom resolution parameters using the SDK
The following code provides an example of how to use the asynchronous resolution API of the Android SDK. For more information, see Custom resolution API.
// Pass custom resolution parameters using the custom resolution API.
Map<String, String> sdnsParams = new HashMap<>();
sdnsParams.put('osType', 'iOS');
HttpDnsService httpdns = HttpDns.getService(applicationContext, accountID, secretKey);
httpdns.getHttpDnsResultForHostAsync(
"www.aliyun.com", // The domain name to resolve.
RequestIpType.auto, // The type of IP address for resolution.
sdnsParams, // The custom resolution parameters.
cacheKey, // The cache key.
new HttpDnsCallback() {
void onHttpDnsCompleted(HTTPDNSResult result) {
// The callback function after the resolution is complete.
// todo something...
}
}
);Add custom resolution parameters using an HTTP API operation
If you resolve a domain name and use the following URL:
http://203.107.XXX.XXX/{accountId}/d?host={domain-name}&ip={client-ip}&sdns-osType=iOS
Replace 203.107.XXX.XXX with the HTTPDNS service IP address. For more information, see Obtain the service IP address.
Replace {accountId} with the corresponding value specified in the console.
Replace {Domain name} with the domain name that you want to resolve.
Replace {IP address of a specific line} with the IP address of the client that you need to verify.
Prefix custom resolution parameters with
sdns-. Otherwise, the parameters are ignored. For example: sdns-osType=iOS.