API | 操作名 | 操作描述 |
PUT Bucket domain | 设置自定义域名 | 设置存储桶的自定义域名信息 |
GET Bucket domain | 查询自定义域名 | 查询存储桶的自定义域名信息 |
try{// 存储桶名称,此处填入格式必须为 bucketname-APPID, 其中 APPID 获取参考 https://console.tencentcloud.com/developerstring bucket = "examplebucket-1250000000";DomainConfiguration domain = new DomainConfiguration();domain.rule = new DomainConfiguration.DomainRule();domain.rule.Name = "www.qq.com";domain.rule.Status = "ENABLED";domain.rule.Type = "WEBSITE";PutBucketDomainRequest request = new PutBucketDomainRequest(bucket, domain);//执行请求PutBucketDomainResult result = cosXml.PutBucketDomain(request);//请求成功Console.WriteLine(result.GetResultInfo());}catch (COSXML.CosException.CosClientException clientEx){//请求失败Console.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){//请求失败Console.WriteLine("CosServerException: " + serverEx.GetInfo());}
状态码 | 说明 |
HTTP 409 Conflict | 该域名记录已存在,且请求中没有设置强制覆盖。或者该域名记录不存在,且请求中设置了强制覆盖 |
HTTP 451 Unavailable For Legal Reasons | 该域名是中国境内域名,并且没有备案 |
try{// 存储桶名称,此处填入格式必须为 bucketname-APPID, 其中 APPID 获取参考 https://console.tencentcloud.com/developerstring bucket = "examplebucket-1250000000";GetBucketDomainRequest request = new GetBucketDomainRequest(bucket);//执行请求GetBucketDomainResult result = cosXml.GetBucketDomain(request);//请求成功Console.WriteLine(result.domainConfiguration);}catch (COSXML.CosException.CosClientException clientEx){//请求失败Console.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){//请求失败Console.WriteLine("CosServerException: " + serverEx.GetInfo());}
参数名称 | 描述 | 类型 |
x-cos-domain-txt-verification | 域名校验信息,该字段是一个 MD5 校验值,原串格式为: cos[Region][BucketName-APPID][BucketCreateTime] ,其中 Region 为存储桶所在地域,BucketCreateTime 为存储桶 GMT 创建时间 | String |
本页内容是否解决了您的问题?