TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
XhotelRoomUpdateRequest req = new XhotelRoomUpdateRequest();
req.setGid(100000L);
req.setOutRid("123321");
req.setVendor("taobao");
req.setTitle("aaa");
req.setGuide("aaa");
req.setDesc("bbb");
req.setPic(new FileItem("/tmp/file.txt"));
req.setHasReceipt(true);
req.setReceiptType("A");
req.setReceiptOtherTypeDesc("aaa");
req.setReceiptInfo("bbb");
req.setInventory("[ { \"date\": \"2017-01-28\", \"quota\": 10, \"al_quota\": 2, \"sp_quota\": 3 }, { \"date\": \"2017-01-29\", \"quota\": 10, \"al_quota\": 2, \"sp_quota\": 3 } ]");
req.setRoomSwitchCal("[{\"date\":\"yyyy-MM-dd\",\"room_status\":2},{\"date\":\"yyyy-MM-dd\",\"room_status\":1}]");
req.setSuperbookEndTime("20:00:00");
req.setSuperbookStartTime("08:00:00");
req.setAllotmentEndTime("20:00:00");
req.setAllotmentStartTime("08:00:00");
req.setStatus(1L);
XhotelRoomUpdateResponse rsp = client.execute(req, sessionKey);
System.out.println(rsp.getBody());
ITopClient client = new DefaultTopClient(url, appkey, secret);
XhotelRoomUpdateRequest req = new XhotelRoomUpdateRequest();
req.Gid = 100000L;
req.OutRid = "123321";
req.Vendor = "taobao";
req.Title = "aaa";
req.Guide = "aaa";
req.Desc = "bbb";
req.Pic = new FileItem("/tmp/file.txt");
req.HasReceipt = true;
req.ReceiptType = "A";
req.ReceiptOtherTypeDesc = "aaa";
req.ReceiptInfo = "bbb";
req.Inventory = "[ { \"date\": \"2017-01-28\", \"quota\": 10, \"al_quota\": 2, \"sp_quota\": 3 }, { \"date\": \"2017-01-29\", \"quota\": 10, \"al_quota\": 2, \"sp_quota\": 3 } ]";
req.RoomSwitchCal = "[{\"date\":\"yyyy-MM-dd\",\"room_status\":2},{\"date\":\"yyyy-MM-dd\",\"room_status\":1}]";
req.SuperbookEndTime = "20:00:00";
req.SuperbookStartTime = "08:00:00";
req.AllotmentEndTime = "20:00:00";
req.AllotmentStartTime = "08:00:00";
req.Status = 1L;
XhotelRoomUpdateResponse rsp = client.Execute(req, sessionKey);
Console.WriteLine(rsp.Body);
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new XhotelRoomUpdateRequest;
$req->setGid("100000");
$req->setOutRid("123321");
$req->setVendor("taobao");
$req->setTitle("aaa");
$req->setGuide("aaa");
$req->setDesc("bbb");
//附件上传的机制参见PHP CURL文档,在文件路径前加@符号即可
$req->setPic(@fileLocation);
$req->setHasReceipt("true");
$req->setReceiptType("A");
$req->setReceiptOtherTypeDesc("aaa");
$req->setReceiptInfo("bbb");
$req->setInventory("[ { \"date\": \"2017-01-28\", \"quota\": 10, \"al_quota\": 2, \"sp_quota\": 3 }, { \"date\": \"2017-01-29\", \"quota\": 10, \"al_quota\": 2, \"sp_quota\": 3 } ]");
$req->setRoomSwitchCal("[{\"date\":\"yyyy-MM-dd\",\"room_status\":2},{\"date\":\"yyyy-MM-dd\",\"room_status\":1}]");
$req->setSuperbookEndTime("20:00:00");
$req->setSuperbookStartTime("08:00:00");
$req->setAllotmentEndTime("20:00:00");
$req->setAllotmentStartTime("08:00:00");
$req->setStatus("1");
$resp = $c->execute($req, $sessionKey);
curl -X POST 'http://gw.api.taobao.com/router/rest' \
-H 'Content-Type:multipart/form-data;charset=utf-8' \
-F 'app_key=12129701' \
-F 'format=json' \
-F 'method=taobao.xhotel.room.update' \
-F 'partner_id=apidoc' \
-F 'session=32c5078f-0c7d-4df8-83a9-b02e36f6187e' \
-F 'sign=912C86A4EB3D9EC2CB742B313F3E103D' \
-F 'sign_method=hmac' \
-F 'timestamp=2024-12-26+19%3A00%3A08' \
-F 'v=2.0' \
-F 'allotment_end_time=20%3A00%3A00' \
-F 'allotment_start_time=08%3A00%3A00' \
-F 'desc=bbb' \
-F 'gid=100000' \
-F 'guide=aaa' \
-F 'has_receipt=true' \
-F 'inventory=+++++%7B+++++++++%22date%22%3A+%222017-01-28%22%2C+++++++++%22quota%22%3A+10%2C+++++++++%22al_quota%22%3A+2%2C+++++++++%22sp_quota%22%3A+3+++++%7D%2C+++++%7B+++++++++%22date%22%3A+%222017-01-29%22%2C+++++++++%22quota%22%3A+10%2C+++++++++%22al_quota%22%3A+2%2C+++++++++%22sp_quota%22%3A+3+++++%7D+' \
-F 'out_rid=123321' \
-F 'receipt_info=bbb' \
-F 'receipt_other_type_desc=aaa' \
-F 'receipt_type=A' \
-F 'room_switch_cal=%7B%22date%22%3A%22yyyy-MM-dd%22%2C%22room_status%22%3A2%7D%2C%7B%22date%22%3A%22yyyy-MM-dd%22%2C%22room_status%22%3A1%7D' \
-F 'status=1' \
-F 'superbook_end_time=20%3A00%3A00' \
-F 'superbook_start_time=08%3A00%3A00' \
-F 'title=aaa' \
-F 'vendor=taobao' \
-F 'pic=@/tmp/file.txt'
# -*- coding: utf-8 -*-
import top.api
req=top.api.XhotelRoomUpdateRequest(url,port)
req.set_app_info(top.appinfo(appkey,secret))
req.gid=100000
req.out_rid="123321"
req.vendor="taobao"
req.title="aaa"
req.guide="aaa"
req.desc="bbb"
req.pic=top.api.FileItem('abc.jpg',open('abc.jpg','rb'))
req.has_receipt=true
req.receipt_type="A"
req.receipt_other_type_desc="aaa"
req.receipt_info="bbb"
req.inventory="[ { \"date\": \"2017-01-28\", \"quota\": 10, \"al_quota\": 2, \"sp_quota\": 3 }, { \"date\": \"2017-01-29\", \"quota\": 10, \"al_quota\": 2, \"sp_quota\": 3 } ]"
req.room_switch_cal="[{\"date\":\"yyyy-MM-dd\",\"room_status\":2},{\"date\":\"yyyy-MM-dd\",\"room_status\":1}]"
req.superbook_end_time="20:00:00"
req.superbook_start_time="08:00:00"
req.allotment_end_time="20:00:00"
req.allotment_start_time="08:00:00"
req.status=1
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.room.update");
add_param(pRequest,"gid","100000");
add_param(pRequest,"out_rid","123321");
add_param(pRequest,"vendor","taobao");
add_param(pRequest,"title","aaa");
add_param(pRequest,"guide","aaa");
add_param(pRequest,"desc","bbb");
add_file_param(pRequest,"pic","文件内容");
add_param(pRequest,"has_receipt","true");
add_param(pRequest,"receipt_type","A");
add_param(pRequest,"receipt_other_type_desc","aaa");
add_param(pRequest,"receipt_info","bbb");
add_param(pRequest,"inventory"," { "date": "2017-01-28", "quota": 10, "al_quota": 2, "sp_quota": 3 }, { "date": "2017-01-29", "quota": 10, "al_quota": 2, "sp_quota": 3 } ");
add_param(pRequest,"room_switch_cal","{"date":"yyyy-MM-dd","room_status":2},{"date":"yyyy-MM-dd","room_status":1}");
add_param(pRequest,"superbook_end_time","20:00:00");
add_param(pRequest,"superbook_start_time","08:00:00");
add_param(pRequest,"allotment_end_time","20:00:00");
add_param(pRequest,"allotment_start_time","08:00:00");
add_param(pRequest,"status","1");
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.room.update', {
'gid':'100000',
'out_rid':'123321',
'vendor':'taobao',
'title':'aaa',
'guide':'aaa',
'desc':'bbb',
'pic':'文件内容',
'has_receipt':'true',
'receipt_type':'A',
'receipt_other_type_desc':'aaa',
'receipt_info':'bbb',
'inventory':' { "date": "2017-01-28", "quota": 10, "al_quota": 2, "sp_quota": 3 }, { "date": "2017-01-29", "quota": 10, "al_quota": 2, "sp_quota": 3 } ',
'room_switch_cal':'{"date":"yyyy-MM-dd","room_status":2},{"date":"yyyy-MM-dd","room_status":1}',
'superbook_end_time':'20:00:00',
'superbook_start_time':'08:00:00',
'allotment_end_time':'20:00:00',
'allotment_start_time':'08:00:00',
'status':'1'
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})