/// <summary> /// 新增解析记录 /// </summary> /// <param name="config"></param> /// <returns>请求错误会触发HttpRequestException </returns> public bool AddDomainRecord(Config config) { AddDomainRecordModel model = new AddDomainRecordModel { DomainName = config.SetDNSDomainName, RR = config.SetDNSHostRecord, Type = config.SupportDNSType, Value = config.NowPublicNetIP, TTL = config.DomainNameTTL, Line = config.DNSLine }; var uri = API.GetAddDomainRecordUrl(config.AccessKeyId, config.AccessKeySecret, model); var url = config.AliAPIUrl + uri; var result = HttpUtility.Get(url); config.DNSRecordId = JsonConvert.DeserializeObject <dynamic>(result)["RecordId"].ToString(); return(true); }
/// <summary> /// 获取添加解析记录的请求字符串 /// </summary> /// <param name="AccessKeyId"></param> /// <param name="AccessKeySecret"></param> /// <param name="addDomainRecordModel"></param> /// <returns></returns> public static string GetAddDomainRecordUrl(string AccessKeyId, string AccessKeySecret, AddDomainRecordModel addDomainRecordModel) { var model = Common.ToDictionary(addDomainRecordModel); return(GetUrlAPI(AccessKeyId, AccessKeySecret, model)); }