TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
AlibabaAliyunindepDigitalsmsCreatetemplateRequest req = new AlibabaAliyunindepDigitalsmsCreatetemplateRequest();
req.setTemplateName("****模板");
List<AlibabaAliyunindepDigitalsmsCreatetemplateRequest.DigitalSmsTemplateContentDto> list2 = new ArrayList<AlibabaAliyunindepDigitalsmsCreatetemplateRequest.DigitalSmsTemplateContentDto>();
AlibabaAliyunindepDigitalsmsCreatetemplateRequest.DigitalSmsTemplateContentDto obj3 = new AlibabaAliyunindepDigitalsmsCreatetemplateRequest.DigitalSmsTemplateContentDto();
list2.add(obj3);
obj3.setFileSuffix("txt");
obj3.setFileName("file-1.txt");
obj3.setFileSize(1840901L);
obj3.setFileContents("字符");
req.setTemplateContents(list2);
req.setApplyRemark("***业务需要");
AlibabaAliyunindepDigitalsmsCreatetemplateResponse rsp = client.execute(req);
System.out.println(rsp.getBody());
ITopClient client = new DefaultTopClient(url, appkey, secret);
AlibabaAliyunindepDigitalsmsCreatetemplateRequest req = new AlibabaAliyunindepDigitalsmsCreatetemplateRequest();
req.TemplateName = "****模板";
List<AlibabaAliyunindepDigitalsmsCreatetemplateRequest.DigitalSmsTemplateContentDtoDomain> list2 = new List<AlibabaAliyunindepDigitalsmsCreatetemplateRequest.DigitalSmsTemplateContentDtoDomain>();
AlibabaAliyunindepDigitalsmsCreatetemplateRequest.DigitalSmsTemplateContentDtoDomain obj3 = new AlibabaAliyunindepDigitalsmsCreatetemplateRequest.DigitalSmsTemplateContentDtoDomain();
list2.Add(obj3);
obj3.FileSuffix = "txt";
obj3.FileName = "file-1.txt";
obj3.FileSize = 1840901L;
obj3.FileContents = "字符";
req.TemplateContents_ = list2;
req.ApplyRemark = "***业务需要";
AlibabaAliyunindepDigitalsmsCreatetemplateResponse rsp = client.Execute(req);
Console.WriteLine(rsp.Body);
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new AlibabaAliyunindepDigitalsmsCreatetemplateRequest;
$req->setTemplateName("****模板");
$template_contents = new DigitalSmsTemplateContentDto;
$template_contents->file_suffix="txt";
$template_contents->file_name="file-1.txt";
$template_contents->file_size="1840901";
$template_contents->file_contents="字符";
$req->setTemplateContents(json_encode($template_contents));
$req->setApplyRemark("***业务需要");
$resp = $c->execute($req);
curl -X POST 'http://gw.api.taobao.com/router/rest' \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'app_key=12129701' \
-d 'format=json' \
-d 'method=alibaba.aliyunindep.digitalsms.createtemplate' \
-d 'partner_id=apidoc' \
-d 'sign=D9503F0672838C3BF3C2A24200D71D77' \
-d 'sign_method=hmac' \
-d 'timestamp=2024-11-21+14%3A40%3A14' \
-d 'v=2.0' \
-d 'apply_remark=***%E4%B8%9A%E5%8A%A1%E9%9C%80%E8%A6%81' \
-d 'template_contents=null' \
-d 'template_name=****%E6%A8%A1%E6%9D%BF'
# -*- coding: utf-8 -*-
import top.api
req=top.api.AlibabaAliyunindepDigitalsmsCreatetemplateRequest(url,port)
req.set_app_info(top.appinfo(appkey,secret))
req.template_name="****模板"
req.template_contents=""
req.apply_remark="***业务需要"
try:
resp= req.getResponse()
print(resp)
except Exception,e:
print(e)
pTopRequest pRequest = alloc_top_request();
pTopResponse pResponse = NULL;
pTaobaoClient pClient = alloc_taobao_client(url, appkey, appsecret);
set_api_name(pRequest,"alibaba.aliyunindep.digitalsms.createtemplate");
add_param(pRequest,"template_name","****模板");
add_param(pRequest,"template_contents","数据结构JSON示例");
add_param(pRequest,"apply_remark","***业务需要");
pResponse = top_execute(pClient,pRequest,NULL);
printf("ret code:%d\n",pResponse->code);
if(pResponse->code == 0){
pTopResponseIterator ite = init_response_iterator(pResponse);
pResultItem pResultItem = alloc_result_item();
while(parseNext(ite, pResultItem) == 0){
printf("%s:%s\n",pResultItem->key,pResultItem->value);
}
destroy_response_iterator(ite);
destroy_result_item(pResultItem);
}
destroy_top_request(pRequest);
destroy_top_response(pResponse);
destroy_taobao_client(pClient);
TopClient = require('./topClient').TopClient;
var client = new TopClient({
'appkey': 'appkey',
'appsecret': 'secret',
'REST_URL': 'http://gw.api.taobao.com/router/rest'
});
client.execute('alibaba.aliyunindep.digitalsms.createtemplate', {
'template_name':'****模板',
'template_contents':'数据结构JSON示例',
'apply_remark':'***业务需要'
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})