TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
XhotelMultipleratesUpdateRequest req = new XhotelMultipleratesUpdateRequest();
req.setRateQuotaMap("[ { \"useRoomInventory\": false, \"outRoomId\": \"abc\", \"ratePlanCode\": \"WHL03\", \"vendor\": \"\", \"currencyCode\": \"CNY\", \"childAges\": \"2~5\", \"childRule\": [ { \"calculateType\": \"1\", \"ageRange\": \"4~6\", \"numRange\": \"1\", \"feeType\": \"10\" }, { \"calculateType\": \"2\", \"ageRange\": \"2~6\", \"numRange\": \"2\", \"feeType\": \"0.2\" } ], \"priceCalendar\": [ { \"date\": \"2017-04-16\", \"inventoryPrice\": [ { \"lengthOfStay\": 1, \"rateSwitch\": 0, \"quota\": 100, \"price\": [ { \"occupancy\": 5, \"basePrice\": 310000, \"taxAndFee\": 100, \"twoTax\": 200, \"threeTax\": 300, \"fourTax\": 400, \"fiveTax\": 500 } ] } ] } ], \"rateCalDataList\":[ { \"nod\":1, \"nop\":1, \"breakfastCal\":\"[{\\"date\\":\\"yyyy-MM-dd\\",\\"startDate\\":\\"yyyy-MM-dd\\",\\"endDate\\":\\"yyyy-MM-dd\\",\\"breakfast_count\\":0},{\\"date\\":\\"yyyy-MM-dd\\",\\"startDate\\":\\"yyyy-MM-dd\\",\\"endDate\\":\\"yyyy-MM-dd\\",\\"breakfast_count\\":1}]\", \"cancelPolicyCal\":\"[{\\"date\\":\\"yyyy-MM-dd\\",\\"startDate\\":\\"yyyy-MM-dd\\",\\"endDate\\":\\"yyyy-MM-dd\\",\\"cancel_policy\\":{\\"cancelPolicyType\\":1} },{\\"date\\":\\"yyyy-MM-dd\\",\\"startDate\\":\\"yyyy-MM-dd\\",\\"endDate\\":\\"yyyy-MM-dd\\",\\"cancel_policy\\":{\\"cancelPolicyType\\":4,\\"policyInfo\\":{\\"48\\":10,\\"24\\":20}}}]\" } ] } ]");
XhotelMultipleratesUpdateResponse rsp = client.execute(req, sessionKey);
System.out.println(rsp.getBody());
ITopClient client = new DefaultTopClient(url, appkey, secret);
XhotelMultipleratesUpdateRequest req = new XhotelMultipleratesUpdateRequest();
req.RateQuotaMap = "[ { \"useRoomInventory\": false, \"outRoomId\": \"abc\", \"ratePlanCode\": \"WHL03\", \"vendor\": \"\", \"currencyCode\": \"CNY\", \"childAges\": \"2~5\", \"childRule\": [ { \"calculateType\": \"1\", \"ageRange\": \"4~6\", \"numRange\": \"1\", \"feeType\": \"10\" }, { \"calculateType\": \"2\", \"ageRange\": \"2~6\", \"numRange\": \"2\", \"feeType\": \"0.2\" } ], \"priceCalendar\": [ { \"date\": \"2017-04-16\", \"inventoryPrice\": [ { \"lengthOfStay\": 1, \"rateSwitch\": 0, \"quota\": 100, \"price\": [ { \"occupancy\": 5, \"basePrice\": 310000, \"taxAndFee\": 100, \"twoTax\": 200, \"threeTax\": 300, \"fourTax\": 400, \"fiveTax\": 500 } ] } ] } ], \"rateCalDataList\":[ { \"nod\":1, \"nop\":1, \"breakfastCal\":\"[{\\"date\\":\\"yyyy-MM-dd\\",\\"startDate\\":\\"yyyy-MM-dd\\",\\"endDate\\":\\"yyyy-MM-dd\\",\\"breakfast_count\\":0},{\\"date\\":\\"yyyy-MM-dd\\",\\"startDate\\":\\"yyyy-MM-dd\\",\\"endDate\\":\\"yyyy-MM-dd\\",\\"breakfast_count\\":1}]\", \"cancelPolicyCal\":\"[{\\"date\\":\\"yyyy-MM-dd\\",\\"startDate\\":\\"yyyy-MM-dd\\",\\"endDate\\":\\"yyyy-MM-dd\\",\\"cancel_policy\\":{\\"cancelPolicyType\\":1} },{\\"date\\":\\"yyyy-MM-dd\\",\\"startDate\\":\\"yyyy-MM-dd\\",\\"endDate\\":\\"yyyy-MM-dd\\",\\"cancel_policy\\":{\\"cancelPolicyType\\":4,\\"policyInfo\\":{\\"48\\":10,\\"24\\":20}}}]\" } ] } ]";
XhotelMultipleratesUpdateResponse rsp = client.Execute(req, sessionKey);
Console.WriteLine(rsp.Body);
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new XhotelMultipleratesUpdateRequest;
$req->setRateQuotaMap("[ { \"useRoomInventory\": false, \"outRoomId\": \"abc\", \"ratePlanCode\": \"WHL03\", \"vendor\": \"\", \"currencyCode\": \"CNY\", \"childAges\": \"2~5\", \"childRule\": [ { \"calculateType\": \"1\", \"ageRange\": \"4~6\", \"numRange\": \"1\", \"feeType\": \"10\" }, { \"calculateType\": \"2\", \"ageRange\": \"2~6\", \"numRange\": \"2\", \"feeType\": \"0.2\" } ], \"priceCalendar\": [ { \"date\": \"2017-04-16\", \"inventoryPrice\": [ { \"lengthOfStay\": 1, \"rateSwitch\": 0, \"quota\": 100, \"price\": [ { \"occupancy\": 5, \"basePrice\": 310000, \"taxAndFee\": 100, \"twoTax\": 200, \"threeTax\": 300, \"fourTax\": 400, \"fiveTax\": 500 } ] } ] } ], \"rateCalDataList\":[ { \"nod\":1, \"nop\":1, \"breakfastCal\":\"[{\\"date\\":\\"yyyy-MM-dd\\",\\"startDate\\":\\"yyyy-MM-dd\\",\\"endDate\\":\\"yyyy-MM-dd\\",\\"breakfast_count\\":0},{\\"date\\":\\"yyyy-MM-dd\\",\\"startDate\\":\\"yyyy-MM-dd\\",\\"endDate\\":\\"yyyy-MM-dd\\",\\"breakfast_count\\":1}]\", \"cancelPolicyCal\":\"[{\\"date\\":\\"yyyy-MM-dd\\",\\"startDate\\":\\"yyyy-MM-dd\\",\\"endDate\\":\\"yyyy-MM-dd\\",\\"cancel_policy\\":{\\"cancelPolicyType\\":1} },{\\"date\\":\\"yyyy-MM-dd\\",\\"startDate\\":\\"yyyy-MM-dd\\",\\"endDate\\":\\"yyyy-MM-dd\\",\\"cancel_policy\\":{\\"cancelPolicyType\\":4,\\"policyInfo\\":{\\"48\\":10,\\"24\\":20}}}]\" } ] } ]");
$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.multiplerates.update' \
-d 'partner_id=apidoc' \
-d 'session=7022d403-9eac-4aa5-aea8-6165a9590cc0' \
-d 'sign=897908D5EE2C5BB69A1BA0476E5FB0F3' \
-d 'sign_method=hmac' \
-d 'timestamp=2024-11-21+20%3A34%3A02' \
-d 'v=2.0' \
-d 'rate_quota_map=+++++%7B+++++++++%22useRoomInventory%22%3A+false%2C+++++++++%22outRoomId%22%3A+%22abc%22%2C+++++++++%22ratePlanCode%22%3A+%22WHL03%22%2C+++++++++%22vendor%22%3A+%22%22%2C+++++++++%22currencyCode%22%3A+%22CNY%22%2C+++++++++%22childAges%22%3A+%222%7E5%22%2C+++++++++%22childRule%22%3A+%5B+++++++++++++%7B+++++++++++++++++%22calculateType%22%3A+%221%22%2C+++++++++++++++++%22ageRange%22%3A+%224%7E6%22%2C+++++++++++++++++%22numRange%22%3A+%221%22%2C+++++++++++++++++%22feeType%22%3A+%2210%22+++++++++++++%7D%2C+++++++++++++%7B+++++++++++++++++%22calculateType%22%3A+%222%22%2C+++++++++++++++++%22ageRange%22%3A+%222%7E6%22%2C+++++++++++++++++%22numRange%22%3A+%222%22%2C+++++++++++++++++%22feeType%22%3A+%220.2%22+++++++++++++%7D+++++++++%5D%2C+++++++++%22priceCalendar%22%3A+%5B+++++++++++++%7B+++++++++++++++++%22date%22%3A+%222017-04-16%22%2C+++++++++++++++++%22inventoryPrice%22%3A+%5B+++++++++++++++++++++%7B+++++++++++++++++++++++++%22lengthOfStay%22%3A+1%2C+++++++++++++++++++++++++%22rateSwitch%22%3A+0%2C+++++++++++++++++++++++++%22quota%22%3A+100%2C+++++++++++++++++++++++++%22price%22%3A+%5B+++++++++++++++++++++++++++++%7B+++++++++++++++++++++++++++++++++%22occupancy%22%3A+5%2C+++++++++++++++++++++++++++++++++%22basePrice%22%3A+310000%2C+++++++++++++++++++++++++++++++++%22taxAndFee%22%3A+100%2C+++++++++++++++++++++++++++++++++%22twoTax%22%3A+200%2C+++++++++++++++++++++++++++++++++%22threeTax%22%3A+300%2C+++++++++++++++++++++++++++++++++%22fourTax%22%3A+400%2C+++++++++++++++++++++++++++++++++%22fiveTax%22%3A+500+++++++++++++++++++++++++++++%7D+++++++++++++++++++++++++%5D+++++++++++++++++++++%7D+++++++++++++++++%5D+++++++++++++%7D+++++++++%5D%2C+++++++%22rateCalDataList%22%3A%5B+++++++++%7B+++++++++%09%22nod%22%3A1%2C+++++++++++%09%22nop%22%3A1%2C+++++++++++%09%22breakfastCal%22%3A%22%5B%7B%5C%22date%5C%22%3A%5C%22yyyy-MM-dd%5C%22%2C%5C%22startDate%5C%22%3A%5C%22yyyy-MM-dd%5C%22%2C%5C%22endDate%5C%22%3A%5C%22yyyy-MM-dd%5C%22%2C%5C%22breakfast_count%5C%22%3A0%7D%2C%7B%5C%22date%5C%22%3A%5C%22yyyy-MM-dd%5C%22%2C%5C%22startDate%5C%22%3A%5C%22yyyy-MM-dd%5C%22%2C%5C%22endDate%5C%22%3A%5C%22yyyy-MM-dd%5C%22%2C%5C%22breakfast_count%5C%22%3A1%7D%5D%22%2C+++++++++%09%22cancelPolicyCal%22%3A%22%5B%7B%5C%22date%5C%22%3A%5C%22yyyy-MM-dd%5C%22%2C%5C%22startDate%5C%22%3A%5C%22yyyy-MM-dd%5C%22%2C%5C%22endDate%5C%22%3A%5C%22yyyy-MM-dd%5C%22%2C%5C%22cancel_policy%5C%22%3A%7B%5C%22cancelPolicyType%5C%22%3A1%7D+%7D%2C%7B%5C%22date%5C%22%3A%5C%22yyyy-MM-dd%5C%22%2C%5C%22startDate%5C%22%3A%5C%22yyyy-MM-dd%5C%22%2C%5C%22endDate%5C%22%3A%5C%22yyyy-MM-dd%5C%22%2C%5C%22cancel_policy%5C%22%3A%7B%5C%22cancelPolicyType%5C%22%3A4%2C%5C%22policyInfo%5C%22%3A%7B%5C%2248%5C%22%3A10%2C%5C%2224%5C%22%3A20%7D%7D%7D%5D%22+++++++++%7D+++++++%5D+++++%7D+'
# -*- coding: utf-8 -*-
import top.api
req=top.api.XhotelMultipleratesUpdateRequest(url,port)
req.set_app_info(top.appinfo(appkey,secret))
req.rate_quota_map="[ { \"useRoomInventory\": false, \"outRoomId\": \"abc\", \"ratePlanCode\": \"WHL03\", \"vendor\": \"\", \"currencyCode\": \"CNY\", \"childAges\": \"2~5\", \"childRule\": [ { \"calculateType\": \"1\", \"ageRange\": \"4~6\", \"numRange\": \"1\", \"feeType\": \"10\" }, { \"calculateType\": \"2\", \"ageRange\": \"2~6\", \"numRange\": \"2\", \"feeType\": \"0.2\" } ], \"priceCalendar\": [ { \"date\": \"2017-04-16\", \"inventoryPrice\": [ { \"lengthOfStay\": 1, \"rateSwitch\": 0, \"quota\": 100, \"price\": [ { \"occupancy\": 5, \"basePrice\": 310000, \"taxAndFee\": 100, \"twoTax\": 200, \"threeTax\": 300, \"fourTax\": 400, \"fiveTax\": 500 } ] } ] } ], \"rateCalDataList\":[ { \"nod\":1, \"nop\":1, \"breakfastCal\":\"[{\\"date\\":\\"yyyy-MM-dd\\",\\"startDate\\":\\"yyyy-MM-dd\\",\\"endDate\\":\\"yyyy-MM-dd\\",\\"breakfast_count\\":0},{\\"date\\":\\"yyyy-MM-dd\\",\\"startDate\\":\\"yyyy-MM-dd\\",\\"endDate\\":\\"yyyy-MM-dd\\",\\"breakfast_count\\":1}]\", \"cancelPolicyCal\":\"[{\\"date\\":\\"yyyy-MM-dd\\",\\"startDate\\":\\"yyyy-MM-dd\\",\\"endDate\\":\\"yyyy-MM-dd\\",\\"cancel_policy\\":{\\"cancelPolicyType\\":1} },{\\"date\\":\\"yyyy-MM-dd\\",\\"startDate\\":\\"yyyy-MM-dd\\",\\"endDate\\":\\"yyyy-MM-dd\\",\\"cancel_policy\\":{\\"cancelPolicyType\\":4,\\"policyInfo\\":{\\"48\\":10,\\"24\\":20}}}]\" } ] } ]"
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.multiplerates.update");
add_param(pRequest,"rate_quota_map"," { "useRoomInventory": false, "outRoomId": "abc", "ratePlanCode": "WHL03", "vendor": "", "currencyCode": "CNY", "childAges": "2~5", "childRule": [ { "calculateType": "1", "ageRange": "4~6", "numRange": "1", "feeType": "10" }, { "calculateType": "2", "ageRange": "2~6", "numRange": "2", "feeType": "0.2" } ], "priceCalendar": [ { "date": "2017-04-16", "inventoryPrice": [ { "lengthOfStay": 1, "rateSwitch": 0, "quota": 100, "price": [ { "occupancy": 5, "basePrice": 310000, "taxAndFee": 100, "twoTax": 200, "threeTax": 300, "fourTax": 400, "fiveTax": 500 } ] } ] } ], "rateCalDataList":[ { "nod":1, "nop":1, "breakfastCal":"[{\"date\":\"yyyy-MM-dd\",\"startDate\":\"yyyy-MM-dd\",\"endDate\":\"yyyy-MM-dd\",\"breakfast_count\":0},{\"date\":\"yyyy-MM-dd\",\"startDate\":\"yyyy-MM-dd\",\"endDate\":\"yyyy-MM-dd\",\"breakfast_count\":1}]", "cancelPolicyCal":"[{\"date\":\"yyyy-MM-dd\",\"startDate\":\"yyyy-MM-dd\",\"endDate\":\"yyyy-MM-dd\",\"cancel_policy\":{\"cancelPolicyType\":1} },{\"date\":\"yyyy-MM-dd\",\"startDate\":\"yyyy-MM-dd\",\"endDate\":\"yyyy-MM-dd\",\"cancel_policy\":{\"cancelPolicyType\":4,\"policyInfo\":{\"48\":10,\"24\":20}}}]" } ] } ");
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.multiplerates.update', {
'rate_quota_map':' { "useRoomInventory": false, "outRoomId": "abc", "ratePlanCode": "WHL03", "vendor": "", "currencyCode": "CNY", "childAges": "2~5", "childRule": [ { "calculateType": "1", "ageRange": "4~6", "numRange": "1", "feeType": "10" }, { "calculateType": "2", "ageRange": "2~6", "numRange": "2", "feeType": "0.2" } ], "priceCalendar": [ { "date": "2017-04-16", "inventoryPrice": [ { "lengthOfStay": 1, "rateSwitch": 0, "quota": 100, "price": [ { "occupancy": 5, "basePrice": 310000, "taxAndFee": 100, "twoTax": 200, "threeTax": 300, "fourTax": 400, "fiveTax": 500 } ] } ] } ], "rateCalDataList":[ { "nod":1, "nop":1, "breakfastCal":"[{\"date\":\"yyyy-MM-dd\",\"startDate\":\"yyyy-MM-dd\",\"endDate\":\"yyyy-MM-dd\",\"breakfast_count\":0},{\"date\":\"yyyy-MM-dd\",\"startDate\":\"yyyy-MM-dd\",\"endDate\":\"yyyy-MM-dd\",\"breakfast_count\":1}]", "cancelPolicyCal":"[{\"date\":\"yyyy-MM-dd\",\"startDate\":\"yyyy-MM-dd\",\"endDate\":\"yyyy-MM-dd\",\"cancel_policy\":{\"cancelPolicyType\":1} },{\"date\":\"yyyy-MM-dd\",\"startDate\":\"yyyy-MM-dd\",\"endDate\":\"yyyy-MM-dd\",\"cancel_policy\":{\"cancelPolicyType\":4,\"policyInfo\":{\"48\":10,\"24\":20}}}]" } ] } '
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})