TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
PromotionVoucherSyncRequest req = new PromotionVoucherSyncRequest();
PromotionVoucherSyncRequest.VoucherDTO obj1 = new PromotionVoucherSyncRequest.VoucherDTO();
obj1.setBusinessUnit(0L);
obj1.setBuyerId(1231L);
PromotionVoucherSyncRequest.CouponFeature obj2 = new PromotionVoucherSyncRequest.CouponFeature();
obj2.setSupplierLogo("koubei.net/pinpai.png");
obj2.setDetailInstructionUrl("taobao.com/detail");
obj1.setCouponFeature(obj2);
PromotionVoucherSyncRequest.CouponFunction obj3 = new PromotionVoucherSyncRequest.CouponFunction();
obj3.setAmount(100L);
obj3.setStartFee(101L);
obj3.setDiscount("0.95");
obj1.setCouponFunction(obj3);
obj1.setCouponType(258L);
PromotionVoucherSyncRequest.InstanceFeature obj4 = new PromotionVoucherSyncRequest.InstanceFeature();
obj4.setInstruction2Url("koubei.net/mendian.h5");
obj4.setActionPointUrl("koubei.net/using");
obj4.setInstruction1Title("koubei");
obj4.setInstruction2Title("koubei");
obj4.setInstruction3Title("koubei");
obj4.setInstruction1("taobao");
obj4.setInstruction2("taobao");
obj4.setInstruction3("taobao");
obj4.setInstruction1Url("taobao.net/using");
obj4.setInstruction3Url("taobao.net/using");
obj1.setInstanceFeature(obj4);
obj1.setInstruction("使用说明");
obj1.setMemo("备注");
obj1.setOutCouponType(1L);
obj1.setOutInstanceId("ABx21");
obj1.setOutInstanceType(58L);
obj1.setStatus(1L);
obj1.setStoreNum(1L);
obj1.setSupplierId(110L);
obj1.setSupplierType(1L);
obj1.setSupportStore(true);
obj1.setTitle("自定义");
obj1.setVoucherEndTime(StringUtils.parseDateTime("2017-09-28 18:00:00"));
obj1.setVoucherStartTime(StringUtils.parseDateTime("2017-09-28 18:00:00"));
obj1.setInstanceCount(1L);
obj1.setOutCouponId("0");
obj1.setPictures("taobao.net/using.png");
obj1.setSkin("taobao.net/using.png");
obj1.setCouponTag("koubei");
req.setVoucherDto(obj1);
PromotionVoucherSyncResponse rsp = client.execute(req);
System.out.println(rsp.getBody());
ITopClient client = new DefaultTopClient(url, appkey, secret);
PromotionVoucherSyncRequest req = new PromotionVoucherSyncRequest();
PromotionVoucherSyncRequest.VoucherDTODomain obj1 = new PromotionVoucherSyncRequest.VoucherDTODomain();
obj1.BusinessUnit = 0L;
obj1.BuyerId = 1231L;
PromotionVoucherSyncRequest.CouponFeatureDomain obj2 = new PromotionVoucherSyncRequest.CouponFeatureDomain();
obj2.SupplierLogo = "koubei.net/pinpai.png";
obj2.DetailInstructionUrl = "taobao.com/detail";
obj1.CouponFeature= obj2;
PromotionVoucherSyncRequest.CouponFunctionDomain obj3 = new PromotionVoucherSyncRequest.CouponFunctionDomain();
obj3.Amount = 100L;
obj3.StartFee = 101L;
obj3.Discount = "0.95";
obj1.CouponFunction= obj3;
obj1.CouponType = 258L;
PromotionVoucherSyncRequest.InstanceFeatureDomain obj4 = new PromotionVoucherSyncRequest.InstanceFeatureDomain();
obj4.Instruction2Url = "koubei.net/mendian.h5";
obj4.ActionPointUrl = "koubei.net/using";
obj4.Instruction1Title = "koubei";
obj4.Instruction2Title = "koubei";
obj4.Instruction3Title = "koubei";
obj4.Instruction1 = "taobao";
obj4.Instruction2 = "taobao";
obj4.Instruction3 = "taobao";
obj4.Instruction1Url = "taobao.net/using";
obj4.Instruction3Url = "taobao.net/using";
obj1.InstanceFeature= obj4;
obj1.Instruction = "使用说明";
obj1.Memo = "备注";
obj1.OutCouponType = 1L;
obj1.OutInstanceId = "ABx21";
obj1.OutInstanceType = 58L;
obj1.Status = 1L;
obj1.StoreNum = 1L;
obj1.SupplierId = 110L;
obj1.SupplierType = 1L;
obj1.SupportStore = true;
obj1.Title = "自定义";
obj1.VoucherEndTime = DateTime.Parse(2017-09-28 18:00:00");
obj1.VoucherStartTime = DateTime.Parse(2017-09-28 18:00:00");
obj1.InstanceCount = 1L;
obj1.OutCouponId = "0";
obj1.Pictures = "taobao.net/using.png";
obj1.Skin = "taobao.net/using.png";
obj1.CouponTag = "koubei";
req.VoucherDto_ = obj1;
PromotionVoucherSyncResponse rsp = client.Execute(req);
Console.WriteLine(rsp.Body);
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new PromotionVoucherSyncRequest;
$voucher_dto = new VoucherDTO;
$voucher_dto->business_unit="0";
$voucher_dto->buyer_id="1231";
$coupon_feature = new CouponFeature;
$coupon_feature->supplier_logo="koubei.net/pinpai.png";
$coupon_feature->detail_instruction_url="taobao.com/detail";
$voucher_dto->coupon_feature = $coupon_feature;
$coupon_function = new CouponFunction;
$coupon_function->amount="100";
$coupon_function->start_fee="101";
$coupon_function->discount="0.95";
$voucher_dto->coupon_function = $coupon_function;
$voucher_dto->coupon_type="258";
$instance_feature = new InstanceFeature;
$instance_feature->instruction2_url="koubei.net/mendian.h5";
$instance_feature->action_point_url="koubei.net/using";
$instance_feature->instruction1_title="koubei";
$instance_feature->instruction2_title="koubei";
$instance_feature->instruction3_title="koubei";
$instance_feature->instruction1="taobao";
$instance_feature->instruction2="taobao";
$instance_feature->instruction3="taobao";
$instance_feature->instruction1_url="taobao.net/using";
$instance_feature->instruction3_url="taobao.net/using";
$voucher_dto->instance_feature = $instance_feature;
$voucher_dto->instruction="使用说明";
$voucher_dto->memo="备注";
$voucher_dto->out_coupon_type="1";
$voucher_dto->out_instance_id="ABx21";
$voucher_dto->out_instance_type="58";
$voucher_dto->status="1";
$voucher_dto->store_num="1";
$voucher_dto->supplier_id="110";
$voucher_dto->supplier_type="1";
$voucher_dto->support_store="true";
$voucher_dto->title="自定义";
$voucher_dto->voucher_end_time="2017-09-28 18:00:00";
$voucher_dto->voucher_start_time="2017-09-28 18:00:00";
$voucher_dto->instance_count="1";
$voucher_dto->out_coupon_id="0";
$voucher_dto->pictures="taobao.net/using.png";
$voucher_dto->skin="taobao.net/using.png";
$voucher_dto->coupon_tag="koubei";
$req->setVoucherDto(json_encode($voucher_dto));
$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=taobao.promotion.voucher.sync' \
-d 'partner_id=apidoc' \
-d 'sign=224AE0CBD0DAEF4117E064207B76B45C' \
-d 'sign_method=hmac' \
-d 'timestamp=2025-05-02+22%3A21%3A34' \
-d 'v=2.0' \
-d 'voucher_dto=null'
# -*- coding: utf-8 -*-
import top.api
req=top.api.PromotionVoucherSyncRequest(url,port)
req.set_app_info(top.appinfo(appkey,secret))
req.voucher_dto=""
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,"taobao.promotion.voucher.sync");
add_param(pRequest,"voucher_dto","数据结构JSON示例");
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('taobao.promotion.voucher.sync', {
'voucher_dto':'数据结构JSON示例'
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})