TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
XhotelBnbpromoAddRequest req = new XhotelBnbpromoAddRequest();
XhotelBnbpromoAddRequest.PromoInfo obj1 = new XhotelBnbpromoAddRequest.PromoInfo();
XhotelBnbpromoAddRequest.TonightDiscount obj2 = new XhotelBnbpromoAddRequest.TonightDiscount();
obj2.setInvestmentNumber("30");
obj2.setStartTime("20:00:00");
obj1.setTonightDiscount(obj2);
XhotelBnbpromoAddRequest.LongOrderInfo obj3 = new XhotelBnbpromoAddRequest.LongOrderInfo();
obj3.setInvestmentNumber(30L);
obj3.setMinContinuityStay(30L);
obj1.setLongOrderInfo(obj3);
XhotelBnbpromoAddRequest.EarlyBookingInfo obj4 = new XhotelBnbpromoAddRequest.EarlyBookingInfo();
obj4.setInvestmentNumber(30L);
obj4.setMinPreBookingDays(7L);
obj1.setEarlyBookingInfo(obj4);
XhotelBnbpromoAddRequest.DailyBookingInfo obj5 = new XhotelBnbpromoAddRequest.DailyBookingInfo();
obj5.setInvestmentNumber(20L);
obj5.setValidWeeks("1,2,3,4,5,6,7");
obj1.setDailyBookingInfo(obj5);
XhotelBnbpromoAddRequest.GeneralBookingInfo obj6 = new XhotelBnbpromoAddRequest.GeneralBookingInfo();
obj6.setInvestmentNumber(20L);
obj6.setCheckInFrom(StringUtils.parseDateTime("2023-10-20 18:00:00"));
obj6.setCheckOutTo(StringUtils.parseDateTime("2023-10-20 18:00:00"));
obj1.setGeneralBookingInfo(obj6);
req.setPromoInfo(obj1);
XhotelBnbpromoAddResponse rsp = client.execute(req, sessionKey);
System.out.println(rsp.getBody());
ITopClient client = new DefaultTopClient(url, appkey, secret);
XhotelBnbpromoAddRequest req = new XhotelBnbpromoAddRequest();
XhotelBnbpromoAddRequest.PromoInfoDomain obj1 = new XhotelBnbpromoAddRequest.PromoInfoDomain();
XhotelBnbpromoAddRequest.TonightDiscountDomain obj2 = new XhotelBnbpromoAddRequest.TonightDiscountDomain();
obj2.InvestmentNumber = "30";
obj2.StartTime = "20:00:00";
obj1.TonightDiscount= obj2;
XhotelBnbpromoAddRequest.LongOrderInfoDomain obj3 = new XhotelBnbpromoAddRequest.LongOrderInfoDomain();
obj3.InvestmentNumber = 30L;
obj3.MinContinuityStay = 30L;
obj1.LongOrderInfo= obj3;
XhotelBnbpromoAddRequest.EarlyBookingInfoDomain obj4 = new XhotelBnbpromoAddRequest.EarlyBookingInfoDomain();
obj4.InvestmentNumber = 30L;
obj4.MinPreBookingDays = 7L;
obj1.EarlyBookingInfo= obj4;
XhotelBnbpromoAddRequest.DailyBookingInfoDomain obj5 = new XhotelBnbpromoAddRequest.DailyBookingInfoDomain();
obj5.InvestmentNumber = 20L;
obj5.ValidWeeks = "1,2,3,4,5,6,7";
obj1.DailyBookingInfo= obj5;
XhotelBnbpromoAddRequest.GeneralBookingInfoDomain obj6 = new XhotelBnbpromoAddRequest.GeneralBookingInfoDomain();
obj6.InvestmentNumber = 20L;
obj6.CheckInFrom = DateTime.Parse(2023-10-20 18:00:00");
obj6.CheckOutTo = DateTime.Parse(2023-10-20 18:00:00");
obj1.GeneralBookingInfo= obj6;
req.PromoInfo_ = obj1;
XhotelBnbpromoAddResponse rsp = client.Execute(req, sessionKey);
Console.WriteLine(rsp.Body);
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new XhotelBnbpromoAddRequest;
$promo_info = new PromoInfo;
$tonight_discount = new TonightDiscount;
$tonight_discount->investment_number="30";
$tonight_discount->start_time="20:00:00";
$promo_info->tonight_discount = $tonight_discount;
$long_order_info = new LongOrderInfo;
$long_order_info->investment_number="30";
$long_order_info->min_continuity_stay="30";
$promo_info->long_order_info = $long_order_info;
$early_booking_info = new EarlyBookingInfo;
$early_booking_info->investment_number="30";
$early_booking_info->min_pre_booking_days="7";
$promo_info->early_booking_info = $early_booking_info;
$daily_booking_info = new DailyBookingInfo;
$daily_booking_info->investment_number="20";
$daily_booking_info->valid_weeks="[1,2,3,4,5,6,7]";
$promo_info->daily_booking_info = $daily_booking_info;
$general_booking_info = new GeneralBookingInfo;
$general_booking_info->investment_number="20";
$general_booking_info->check_in_from="2023-10-20 18:00:00";
$general_booking_info->check_out_to="2023-10-20 18:00:00";
$promo_info->general_booking_info = $general_booking_info;
$req->setPromoInfo(json_encode($promo_info));
$resp = $c->execute($req, $sessionKey);
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.xhotel.bnbpromo.add' \
-d 'partner_id=apidoc' \
-d 'session=1731399d-d090-4c39-aa55-d9724fa92e95' \
-d 'sign=11B696CF76862B04477900943AD59DBA' \
-d 'sign_method=hmac' \
-d 'timestamp=2024-11-21+20%3A37%3A22' \
-d 'v=2.0' \
-d 'promo_info=null'
# -*- coding: utf-8 -*-
import top.api
req=top.api.XhotelBnbpromoAddRequest(url,port)
req.set_app_info(top.appinfo(appkey,secret))
req.promo_info="数据结构示例JSON格式"
try:
resp= req.getResponse(sessionkey)
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.xhotel.bnbpromo.add");
add_param(pRequest,"promo_info","数据结构JSON示例");
pResponse = top_execute(pClient,pRequest,sessionKey);
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.xhotel.bnbpromo.add', {
'promo_info':'数据结构JSON示例'
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})