/// <summary> /// ⚠️注意:个人认证用户不支持使用 API 删除短信正文模版,请登录 [控制台](https://console.cloud.tencent.com/smsv2) 删除短信正文模版,如需了解请参阅 [实名认证基本介绍](https://cloud.tencent.com/document/product/378/3629)。 /// >- 注:由于云 **API3.0 安全性**有所提升,所以**接口鉴权**较为复杂,建议使用 [SDK](https://cloud.tencent.com/document/product/382/43193) 来使用云短信服务。 /// >- 您可以在 [API 3.0 Explorer](https://console.cloud.tencent.com/api/explorer?Product=sms&Version=2019-07-11&Action=SendSms) 中直接运行该接口,可以先免去签名计算步骤。运行成功后,API Explorer可以**自动生成**SDK代码示例。 /// </summary> /// <param name="req"><see cref="DeleteSmsTemplateRequest"/></param> /// <returns><see cref="DeleteSmsTemplateResponse"/></returns> public DeleteSmsTemplateResponse DeleteSmsTemplateSync(DeleteSmsTemplateRequest req) { JsonResponseModel <DeleteSmsTemplateResponse> rsp = null; try { var strResp = this.InternalRequestSync(req, "DeleteSmsTemplate"); rsp = JsonConvert.DeserializeObject <JsonResponseModel <DeleteSmsTemplateResponse> >(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return(rsp.Response); }
/// <summary> /// 删除短信模板 /// </summary> public void DeleteSmsTemplate() { // 设置请求对象 DeleteSmsTemplateRequest request = new DeleteSmsTemplateRequest { SmsTemplateId = "169a2076213c4553a7ebb3b5ddc07017" }; try { // 发送请求并返回响应 DeleteSmsTemplateResponse response = smnClient.SendRequest(request); string result = response.RequestId; Console.WriteLine("{0}", result); Console.ReadLine(); } catch (Exception e) { // 处理异常 Console.WriteLine("{0}", e.Message); Console.ReadLine(); } }
/// <summary> /// 删除短信模板。 /// </summary> /// <param name="input"></param> /// <returns></returns> public Task <SmsResult> DeleteSmsTemplateAsync(DeleteSmsTemplateInput input) { var client = new AliyunSmsClient(); var acsClient = client.AcsClient; var request = new DeleteSmsTemplateRequest(); var result = new SmsResult(); try { request.TemplateCode = input.TemplateCode; //请求失败这里会抛ClientException异常 var DeleteSmsTemplateResponse = acsClient.GetAcsResponse(request); //发送成功判断 if ("OK".Equals(DeleteSmsTemplateResponse.Code, StringComparison.CurrentCultureIgnoreCase)) { result.Success = true; } else { result.Success = false; result.ErrorMessage = DeleteSmsTemplateResponse.Message; } } catch (ClientException e) { AliyunSmsHelper.LoggerAction("Error", e.ToString()); result.Success = false; result.ErrorMessage = e.ErrorMessage; } catch (Exception e) { AliyunSmsHelper.LoggerAction("Error", e.ToString()); result.Success = false; result.ErrorMessage = e.Message; } return(Task.FromResult(result)); }
public async Task <DeleteSmsTemplateResponse> DeleteSmsTemplateAsync(DeleteSmsTemplateRequest request) { AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions(); return(await DeleteSmsTemplateWithOptionsAsync(request, runtime)); }
public DeleteSmsTemplateResponse DeleteSmsTemplate(DeleteSmsTemplateRequest request) { AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions(); return(DeleteSmsTemplateWithOptions(request, runtime)); }
public async Task <DeleteSmsTemplateResponse> DeleteSmsTemplateWithOptionsAsync(DeleteSmsTemplateRequest request, AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime) { AlibabaCloud.TeaUtil.Common.ValidateModel(request); return(TeaModel.ToObject <DeleteSmsTemplateResponse>(await DoRequestAsync("DeleteSmsTemplate", "HTTPS", "POST", "2017-05-25", "AK", null, request.ToMap(), runtime))); }