阿裡雲解析API,是為域名開發者、注冊商、域名代理商等提供的開放和便捷的解析服務接口。API依托於萬網雲解析服務,可以方便的管理域名和解析記錄,讓你的解析管理變的隨心省時自由舒暢。
1、先附上Aliyun 雲解析API地址
2、再附上整理後的C# 源碼地址
在使用過程中主要使用AliyunRequest類以及派生類、AliyunUtils類、AliyunResponse接口以及繼承該接口的Response類
(1)、AliyunRequest為阿裡雲公共請求消息
public class AliyunRequest { // Fields private string ACCESS_KEY_ID; private string ACCESS_KEY_SECRET; private ResponseFormat API_FORMAT; private string API_VERSION; private HttpVerb HTTP_METHOD; private string SEARCH_BASE_URL; private string SIGNATURE_METHOD; private string SIGNATURE_VERSION; // Methods public AliyunRequest(); public virtual Dictionary<string, string> GeneralParameters(); // Properties public string Access_Key_Secret { get; set; } public string AccessKeyId { get; set; } public virtual ActionType Action { get; } public string Base_Url { get; set; } public ResponseFormat Format { get; set; } public HttpVerb Http_Method { get; set; } public string SignatureMethod { get; set; } public string SignatureVersion { get; set; } public string Version { get; set; } }
(2)、AliyunUtils工具類
public class AliyunUtils { // Fields private static AliyunRequest AliyunRequest; // Methods static AliyunUtils(); public AliyunUtils(); private static AliyunResponse _analyzeJson(ActionType action, string content); private static AliyunResponse _analyzeResponse(ActionType type, ResponseFormat format, string content); public static string GeneralURL(AliyunRequest request); public static string GeneralURL(Dictionary<string, string> parameters); public static ErrorMessage GetErrorMessage(ErrorResponse error); public static AliyunHtmlResponse GetHtmlResponse(string html); public static AliyunHtmlResponse GetHtmlResponse(string html, ResponseFormat format); public static AliyunResponse GetResponse(AliyunRequest request); public static AliyunResponse GetResponse(ActionType type, Dictionary<string, string> parameters); public static void Init(AliyunRequest AliyunRequest); }
3、再附上對應的chm文檔
以下為包含的結構:
使用方法如下圖所示
分別執行,得到的_res和_res2結構應該是相同的。
代碼中可能存在不足的地方,還請指出,也希望這對大家有所幫助