TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
XhotelRatesUpdateRequest req = new XhotelRatesUpdateRequest();
req.setRateInventoryPriceMap("[{\"out_rid\":\"ABCDE_123\",\"rateplan_code\":\"ABCDE_WHL01\",\"vendor\":\"\",\"lock_start_time\":\"\",\"lock_end_time\":\"\",\"data\":{\"use_room_inventory\":false,\"inventory_price\":[{\"date\":\"2013-11-18\",\"quota\":1,\"price\":1000,\"status\":1},{\"date\":\"2013-11-19\",\"quota\":1,\"price\":1000,\"status\":0}]}},{\"out_rid\":\"ABCDE_234\",\"rateplan_code\":\"ABCDE_WHL01\",\"vendor\":\"\",\"data\":{\"use_room_inventory\":false,\"inventory_price\":[{\"date\":\"2013-11-18\",\"quota\":1,\"price\":1000,\"status\":1},{\"date\":\"2013-11-19\",\"quota\":1,\"price\":1000,\"status\":0}]}}]");
req.setStandardXitemInfos("[ { \"actionType\": \"BOUND\", \"outXCode\": \"123456\", \"subTypeCode\": \"70000_200\", \"name\": \"下午茶更新\", \"poi\": \"杭州西湖\", \"poiAddition\": \"杭州西湖addition\", \"subProducts\": [ { \"name\": \"早餐\", \"amount\": 1,#如果子产品是早餐,份数建议与rate_quota_map这个价库字段的nop一致;若加赠早餐场景下,份数可自行控制 \"price\": 38 } ], \"availableSubAmount\": 3, \"priceValue\": { \"price\": 100, \"sellingPrice\": 100 }, \"useRule\": { \"receptionTime\": [ { \"startTime\": \"00:00\", \"endTime\": \"01:00\" }, { \"startTime\": \"02:00\", \"endTime\": \"03:00\" }, { \"startTime\": \"03:00\", \"endTime\": \"04:00\" } ], \"adultAmount\": 2, \"childAmount\": 1, \"childHeight\": \"120\", \"childAge\": \"8\", \"bookingRule\": 1, \"bookingMinAmount\": 2, \"bookingUnit\": 1, \"contactNumber\": \"05316776678\", \"acquireType\": 1, \"effectiveType\": 0, \"additionalReminder\": \"补充提醒\" }, \"actionDimension\": 1, \"startDateTime\": \"2023-07-13 00:00:01\", \"endDateTime\": \"2024-07-13 00:00:01\", \"displayStartTime\": \"2023-07-13 00:00:01\", \"displayEndTime\": \"2024-07-13 00:00:01\", \"availableWeekDays\": \"1,2,3,4,5,6,7\", \"amount\": 2, \"childAmount\": 2 } ]");
XhotelRatesUpdateResponse rsp = client.execute(req, sessionKey);
System.out.println(rsp.getBody());
ITopClient client = new DefaultTopClient(url, appkey, secret);
XhotelRatesUpdateRequest req = new XhotelRatesUpdateRequest();
req.RateInventoryPriceMap = "[{\"out_rid\":\"ABCDE_123\",\"rateplan_code\":\"ABCDE_WHL01\",\"vendor\":\"\",\"lock_start_time\":\"\",\"lock_end_time\":\"\",\"data\":{\"use_room_inventory\":false,\"inventory_price\":[{\"date\":\"2013-11-18\",\"quota\":1,\"price\":1000,\"status\":1},{\"date\":\"2013-11-19\",\"quota\":1,\"price\":1000,\"status\":0}]}},{\"out_rid\":\"ABCDE_234\",\"rateplan_code\":\"ABCDE_WHL01\",\"vendor\":\"\",\"data\":{\"use_room_inventory\":false,\"inventory_price\":[{\"date\":\"2013-11-18\",\"quota\":1,\"price\":1000,\"status\":1},{\"date\":\"2013-11-19\",\"quota\":1,\"price\":1000,\"status\":0}]}}]";
req.StandardXitemInfos = "[ { \"actionType\": \"BOUND\", \"outXCode\": \"123456\", \"subTypeCode\": \"70000_200\", \"name\": \"下午茶更新\", \"poi\": \"杭州西湖\", \"poiAddition\": \"杭州西湖addition\", \"subProducts\": [ { \"name\": \"早餐\", \"amount\": 1,#如果子产品是早餐,份数建议与rate_quota_map这个价库字段的nop一致;若加赠早餐场景下,份数可自行控制 \"price\": 38 } ], \"availableSubAmount\": 3, \"priceValue\": { \"price\": 100, \"sellingPrice\": 100 }, \"useRule\": { \"receptionTime\": [ { \"startTime\": \"00:00\", \"endTime\": \"01:00\" }, { \"startTime\": \"02:00\", \"endTime\": \"03:00\" }, { \"startTime\": \"03:00\", \"endTime\": \"04:00\" } ], \"adultAmount\": 2, \"childAmount\": 1, \"childHeight\": \"120\", \"childAge\": \"8\", \"bookingRule\": 1, \"bookingMinAmount\": 2, \"bookingUnit\": 1, \"contactNumber\": \"05316776678\", \"acquireType\": 1, \"effectiveType\": 0, \"additionalReminder\": \"补充提醒\" }, \"actionDimension\": 1, \"startDateTime\": \"2023-07-13 00:00:01\", \"endDateTime\": \"2024-07-13 00:00:01\", \"displayStartTime\": \"2023-07-13 00:00:01\", \"displayEndTime\": \"2024-07-13 00:00:01\", \"availableWeekDays\": \"1,2,3,4,5,6,7\", \"amount\": 2, \"childAmount\": 2 } ]";
XhotelRatesUpdateResponse rsp = client.Execute(req, sessionKey);
Console.WriteLine(rsp.Body);
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new XhotelRatesUpdateRequest;
$req->setRateInventoryPriceMap("[{\"out_rid\":\"ABCDE_123\",\"rateplan_code\":\"ABCDE_WHL01\",\"vendor\":\"\",\"lock_start_time\":\"\",\"lock_end_time\":\"\",\"data\":{\"use_room_inventory\":false,\"inventory_price\":[{\"date\":\"2013-11-18\",\"quota\":1,\"price\":1000,\"status\":1},{\"date\":\"2013-11-19\",\"quota\":1,\"price\":1000,\"status\":0}]}},{\"out_rid\":\"ABCDE_234\",\"rateplan_code\":\"ABCDE_WHL01\",\"vendor\":\"\",\"data\":{\"use_room_inventory\":false,\"inventory_price\":[{\"date\":\"2013-11-18\",\"quota\":1,\"price\":1000,\"status\":1},{\"date\":\"2013-11-19\",\"quota\":1,\"price\":1000,\"status\":0}]}}]");
$req->setStandardXitemInfos("[ { \"actionType\": \"BOUND\", \"outXCode\": \"123456\", \"subTypeCode\": \"70000_200\", \"name\": \"下午茶更新\", \"poi\": \"杭州西湖\", \"poiAddition\": \"杭州西湖addition\", \"subProducts\": [ { \"name\": \"早餐\", \"amount\": 1,#如果子产品是早餐,份数建议与rate_quota_map这个价库字段的nop一致;若加赠早餐场景下,份数可自行控制 \"price\": 38 } ], \"availableSubAmount\": 3, \"priceValue\": { \"price\": 100, \"sellingPrice\": 100 }, \"useRule\": { \"receptionTime\": [ { \"startTime\": \"00:00\", \"endTime\": \"01:00\" }, { \"startTime\": \"02:00\", \"endTime\": \"03:00\" }, { \"startTime\": \"03:00\", \"endTime\": \"04:00\" } ], \"adultAmount\": 2, \"childAmount\": 1, \"childHeight\": \"120\", \"childAge\": \"8\", \"bookingRule\": 1, \"bookingMinAmount\": 2, \"bookingUnit\": 1, \"contactNumber\": \"05316776678\", \"acquireType\": 1, \"effectiveType\": 0, \"additionalReminder\": \"补充提醒\" }, \"actionDimension\": 1, \"startDateTime\": \"2023-07-13 00:00:01\", \"endDateTime\": \"2024-07-13 00:00:01\", \"displayStartTime\": \"2023-07-13 00:00:01\", \"displayEndTime\": \"2024-07-13 00:00:01\", \"availableWeekDays\": \"1,2,3,4,5,6,7\", \"amount\": 2, \"childAmount\": 2 } ]");
$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.rates.update' \
-d 'partner_id=apidoc' \
-d 'session=26200b32-e214-4f2c-94ac-0f7e8591b2de' \
-d 'sign=145A53366BFF17D418A04BBEABF59499' \
-d 'sign_method=hmac' \
-d 'timestamp=2024-12-26+19%3A33%3A38' \
-d 'v=2.0' \
-d 'rate_inventory_price_map=%7B%22out_rid%22%3A%22ABCDE_123%22%2C%22rateplan_code%22%3A%22ABCDE_WHL01%22%2C%22vendor%22%3A%22%22%2C%22lock_start_time%22%3A%22%22%2C%22lock_end_time%22%3A%22%22%2C%22data%22%3A%7B%22use_room_inventory%22%3Afalse%2C%22inventory_price%22%3A%5B%7B%22date%22%3A%222013-11-18%22%2C%22quota%22%3A1%2C%22price%22%3A1000%2C%22status%22%3A1%7D%2C%7B%22date%22%3A%222013-11-19%22%2C%22quota%22%3A1%2C%22price%22%3A1000%2C%22status%22%3A0%7D%5D%7D%7D%2C%7B%22out_rid%22%3A%22ABCDE_234%22%2C%22rateplan_code%22%3A%22ABCDE_WHL01%22%2C%22vendor%22%3A%22%22%2C%22data%22%3A%7B%22use_room_inventory%22%3Afalse%2C%22inventory_price%22%3A%5B%7B%22date%22%3A%222013-11-18%22%2C%22quota%22%3A1%2C%22price%22%3A1000%2C%22status%22%3A1%7D%2C%7B%22date%22%3A%222013-11-19%22%2C%22quota%22%3A1%2C%22price%22%3A1000%2C%22status%22%3A0%7D%5D%7D%7D' \
-d 'standard_xitem_infos=+%7B+%22actionType%22%3A+%22BOUND%22%2C+%22outXCode%22%3A+%22123456%22%2C+%22subTypeCode%22%3A+%2270000_200%22%2C+%22name%22%3A+%22%E4%B8%8B%E5%8D%88%E8%8C%B6%E6%9B%B4%E6%96%B0%22%2C+%22poi%22%3A+%22%E6%9D%AD%E5%B7%9E%E8%A5%BF%E6%B9%96%22%2C+%22poiAddition%22%3A+%22%E6%9D%AD%E5%B7%9E%E8%A5%BF%E6%B9%96addition%22%2C+%22subProducts%22%3A+%5B+%7B+%22name%22%3A+%22%E6%97%A9%E9%A4%90%22%2C+%22amount%22%3A+1%2C%23%E5%A6%82%E6%9E%9C%E5%AD%90%E4%BA%A7%E5%93%81%E6%98%AF%E6%97%A9%E9%A4%90%EF%BC%8C%E4%BB%BD%E6%95%B0%E5%BB%BA%E8%AE%AE%E4%B8%8Erate_quota_map%E8%BF%99%E4%B8%AA%E4%BB%B7%E5%BA%93%E5%AD%97%E6%AE%B5%E7%9A%84nop%E4%B8%80%E8%87%B4%EF%BC%9B%E8%8B%A5%E5%8A%A0%E8%B5%A0%E6%97%A9%E9%A4%90%E5%9C%BA%E6%99%AF%E4%B8%8B%EF%BC%8C%E4%BB%BD%E6%95%B0%E5%8F%AF%E8%87%AA%E8%A1%8C%E6%8E%A7%E5%88%B6+%22price%22%3A+38+%7D+%5D%2C+%22availableSubAmount%22%3A+3%2C+%22priceValue%22%3A+%7B+%22price%22%3A+100%2C+%22sellingPrice%22%3A+100+%7D%2C+%22useRule%22%3A+%7B+%22receptionTime%22%3A+%5B+%7B+%22startTime%22%3A+%2200%3A00%22%2C+%22endTime%22%3A+%2201%3A00%22+%7D%2C+%7B+%22startTime%22%3A+%2202%3A00%22%2C+%22endTime%22%3A+%2203%3A00%22+%7D%2C+%7B+%22startTime%22%3A+%2203%3A00%22%2C+%22endTime%22%3A+%2204%3A00%22+%7D+%5D%2C+%22adultAmount%22%3A+2%2C+%22childAmount%22%3A+1%2C+%22childHeight%22%3A+%22120%22%2C+%22childAge%22%3A+%228%22%2C+%22bookingRule%22%3A+1%2C+%22bookingMinAmount%22%3A+2%2C+%22bookingUnit%22%3A+1%2C+%22contactNumber%22%3A+%2205316776678%22%2C+%22acquireType%22%3A+1%2C+%22effectiveType%22%3A+0%2C+%22additionalReminder%22%3A+%22%E8%A1%A5%E5%85%85%E6%8F%90%E9%86%92%22+%7D%2C+%22actionDimension%22%3A+1%2C+%22startDateTime%22%3A+%222023-07-13+00%3A00%3A01%22%2C+%22endDateTime%22%3A+%222024-07-13+00%3A00%3A01%22%2C+%22displayStartTime%22%3A+%222023-07-13+00%3A00%3A01%22%2C+%22displayEndTime%22%3A+%222024-07-13+00%3A00%3A01%22%2C+%22availableWeekDays%22%3A+%221%2C2%2C3%2C4%2C5%2C6%2C7%22%2C+%22amount%22%3A+2%2C+%22childAmount%22%3A+2+%7D+'
# -*- coding: utf-8 -*-
import top.api
req=top.api.XhotelRatesUpdateRequest(url,port)
req.set_app_info(top.appinfo(appkey,secret))
req.rate_inventory_price_map="[{\"out_rid\":\"ABCDE_123\",\"rateplan_code\":\"ABCDE_WHL01\",\"vendor\":\"\",\"lock_start_time\":\"\",\"lock_end_time\":\"\",\"data\":{\"use_room_inventory\":false,\"inventory_price\":[{\"date\":\"2013-11-18\",\"quota\":1,\"price\":1000,\"status\":1},{\"date\":\"2013-11-19\",\"quota\":1,\"price\":1000,\"status\":0}]}},{\"out_rid\":\"ABCDE_234\",\"rateplan_code\":\"ABCDE_WHL01\",\"vendor\":\"\",\"data\":{\"use_room_inventory\":false,\"inventory_price\":[{\"date\":\"2013-11-18\",\"quota\":1,\"price\":1000,\"status\":1},{\"date\":\"2013-11-19\",\"quota\":1,\"price\":1000,\"status\":0}]}}]"
req.standard_xitem_infos="[ { \"actionType\": \"BOUND\", \"outXCode\": \"123456\", \"subTypeCode\": \"70000_200\", \"name\": \"下午茶更新\", \"poi\": \"杭州西湖\", \"poiAddition\": \"杭州西湖addition\", \"subProducts\": [ { \"name\": \"早餐\", \"amount\": 1,#如果子产品是早餐,份数建议与rate_quota_map这个价库字段的nop一致;若加赠早餐场景下,份数可自行控制 \"price\": 38 } ], \"availableSubAmount\": 3, \"priceValue\": { \"price\": 100, \"sellingPrice\": 100 }, \"useRule\": { \"receptionTime\": [ { \"startTime\": \"00:00\", \"endTime\": \"01:00\" }, { \"startTime\": \"02:00\", \"endTime\": \"03:00\" }, { \"startTime\": \"03:00\", \"endTime\": \"04:00\" } ], \"adultAmount\": 2, \"childAmount\": 1, \"childHeight\": \"120\", \"childAge\": \"8\", \"bookingRule\": 1, \"bookingMinAmount\": 2, \"bookingUnit\": 1, \"contactNumber\": \"05316776678\", \"acquireType\": 1, \"effectiveType\": 0, \"additionalReminder\": \"补充提醒\" }, \"actionDimension\": 1, \"startDateTime\": \"2023-07-13 00:00:01\", \"endDateTime\": \"2024-07-13 00:00:01\", \"displayStartTime\": \"2023-07-13 00:00:01\", \"displayEndTime\": \"2024-07-13 00:00:01\", \"availableWeekDays\": \"1,2,3,4,5,6,7\", \"amount\": 2, \"childAmount\": 2 } ]"
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.rates.update");
add_param(pRequest,"rate_inventory_price_map","{"out_rid":"ABCDE_123","rateplan_code":"ABCDE_WHL01","vendor":"","lock_start_time":"","lock_end_time":"","data":{"use_room_inventory":false,"inventory_price":[{"date":"2013-11-18","quota":1,"price":1000,"status":1},{"date":"2013-11-19","quota":1,"price":1000,"status":0}]}},{"out_rid":"ABCDE_234","rateplan_code":"ABCDE_WHL01","vendor":"","data":{"use_room_inventory":false,"inventory_price":[{"date":"2013-11-18","quota":1,"price":1000,"status":1},{"date":"2013-11-19","quota":1,"price":1000,"status":0}]}}");
add_param(pRequest,"standard_xitem_infos"," { "actionType": "BOUND", "outXCode": "123456", "subTypeCode": "70000_200", "name": "下午茶更新", "poi": "杭州西湖", "poiAddition": "杭州西湖addition", "subProducts": [ { "name": "早餐", "amount": 1,#如果子产品是早餐,份数建议与rate_quota_map这个价库字段的nop一致;若加赠早餐场景下,份数可自行控制 "price": 38 } ], "availableSubAmount": 3, "priceValue": { "price": 100, "sellingPrice": 100 }, "useRule": { "receptionTime": [ { "startTime": "00:00", "endTime": "01:00" }, { "startTime": "02:00", "endTime": "03:00" }, { "startTime": "03:00", "endTime": "04:00" } ], "adultAmount": 2, "childAmount": 1, "childHeight": "120", "childAge": "8", "bookingRule": 1, "bookingMinAmount": 2, "bookingUnit": 1, "contactNumber": "05316776678", "acquireType": 1, "effectiveType": 0, "additionalReminder": "补充提醒" }, "actionDimension": 1, "startDateTime": "2023-07-13 00:00:01", "endDateTime": "2024-07-13 00:00:01", "displayStartTime": "2023-07-13 00:00:01", "displayEndTime": "2024-07-13 00:00:01", "availableWeekDays": "1,2,3,4,5,6,7", "amount": 2, "childAmount": 2 } ");
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.rates.update', {
'rate_inventory_price_map':'{"out_rid":"ABCDE_123","rateplan_code":"ABCDE_WHL01","vendor":"","lock_start_time":"","lock_end_time":"","data":{"use_room_inventory":false,"inventory_price":[{"date":"2013-11-18","quota":1,"price":1000,"status":1},{"date":"2013-11-19","quota":1,"price":1000,"status":0}]}},{"out_rid":"ABCDE_234","rateplan_code":"ABCDE_WHL01","vendor":"","data":{"use_room_inventory":false,"inventory_price":[{"date":"2013-11-18","quota":1,"price":1000,"status":1},{"date":"2013-11-19","quota":1,"price":1000,"status":0}]}}',
'standard_xitem_infos':' { "actionType": "BOUND", "outXCode": "123456", "subTypeCode": "70000_200", "name": "下午茶更新", "poi": "杭州西湖", "poiAddition": "杭州西湖addition", "subProducts": [ { "name": "早餐", "amount": 1,#如果子产品是早餐,份数建议与rate_quota_map这个价库字段的nop一致;若加赠早餐场景下,份数可自行控制 "price": 38 } ], "availableSubAmount": 3, "priceValue": { "price": 100, "sellingPrice": 100 }, "useRule": { "receptionTime": [ { "startTime": "00:00", "endTime": "01:00" }, { "startTime": "02:00", "endTime": "03:00" }, { "startTime": "03:00", "endTime": "04:00" } ], "adultAmount": 2, "childAmount": 1, "childHeight": "120", "childAge": "8", "bookingRule": 1, "bookingMinAmount": 2, "bookingUnit": 1, "contactNumber": "05316776678", "acquireType": 1, "effectiveType": 0, "additionalReminder": "补充提醒" }, "actionDimension": 1, "startDateTime": "2023-07-13 00:00:01", "endDateTime": "2024-07-13 00:00:01", "displayStartTime": "2023-07-13 00:00:01", "displayEndTime": "2024-07-13 00:00:01", "availableWeekDays": "1,2,3,4,5,6,7", "amount": 2, "childAmount": 2 } '
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})