TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
XhotelRoomtypeAddRequest req = new XhotelRoomtypeAddRequest();
req.setHid(100000L);
req.setName("标准间");
req.setMaxOccupancy(2L);
req.setArea("10");
req.setFloor("3-5层");
req.setBedType("大床");
req.setBedSize("1.8米");
req.setInternet("A");
req.setService("{\"bar\":false,\"catv\":false,\"ddd\":false,\"idd\":false,\"pubtoilet\":false,\"toilet\":false}");
req.setExtend("空");
req.setOuterId("100000");
req.setWindowType(1L);
req.setSrid(123123L);
req.setVendor("taobao");
req.setOutHid("123123");
req.setPics("[{\"url\":\"http://taobao.com/123.jpg\",\"ismain\":\"true\"},{\"url\":\"http://taobao.com/456.jpg\",\"ismain\":\"false\"},{\"url\":\"http://taobao.com/789.jpg\",\"ismain\":\"false\"}]");
req.setNameE("standard room");
req.setOperator("operator");
req.setConnectionType(1L);
req.setBedInfo("[{ \"main_bed_type\": \"10\", \"sub_bed_type\": [{ \"sub_bed_num\": 1, \"bed_type\": \"0\", \"length\": \"1.8\", \"width\": \"2\" }, { \"sub_bed_num\": 1, \"bed_type\": \"0\", \"length\": \"1.8\", \"width\": \"2\" }] }]");
req.setStandardRoomFacilities("{ \"dataVersion\":\"2.0.0\", \"facilityList\":[ {\"500\":true,\"fee\":true}, {\"501\":true,\"option\":\"1\"}, {\"506\":true,\"mul-option\":[\"1\",\"2\"],\"desc\":\"说明\"}, {\"507\":true,\"desc\":\"说明\"}, {\"509\":true,\"value\":\"12:00\",\"fee\":true}, {\"2\":true,\"list\":[ {\"inDoorType\":\"1\",\"fee\":true}, {\"inDoorType\":\"2\",\"fee\":true} ]}, {\"7\":true,\"list\":[ {\"restaurantType\":\"1\",\"name\":\"品珍中餐厅\"}, {\"restaurantType\":\"2\",\"name\":\"和日式料理\"} ]} ] }");
req.setWindowDesc("{ \"windowType\":1, \"windowTypeDefect\":\"1,2\", \"windowTypeSpecial\":2 }");
req.setAddBed("{ \"addBed\":true, \"fee\":true, \"desc\":\"xxxx\" }");
req.setChildrenPolicy("{\"isAllowChildren\": true, //是否允许携带儿童\"isAllowSharingBed\": true, //是否允许儿童共用现有床铺\"policySharingBed\": {//儿童共用床铺信息\"maxChildrenCount\": 3, //允许共用现有床铺的最大儿童数量\"rangeFrom\": 0, //允许共用床铺的起始儿童年龄\"rangeTo\": 17 //允许共用床铺的截止儿童年龄},\"limitChildrenAge\": {//酒店允许入住的儿童年龄范围\"maxChildrenAge\": 17, //最大儿童年龄\"minChildrenAge\": 0 //最小儿童年龄},\"policyContent\": \"该酒店欢迎携带儿童入住\", //儿童政策描述\"extraBedDetails\": [{//儿童加床政策详情 \"rangeFrom\": 0, //儿童起始年龄 \"rangeTo\": 3, //儿童截止年龄 \"extraBedFeeList\": [{\"extraBedType\": 0, //加床类型\"isFree\": false, //是否免费\"fee\": { //费用\"amountCent\": 999, //原始外币报价金额(分)\"amount\": 9.99, //原始外币报价金额(元)\"currencyCode\": \"CNY\"//币种代码}}, {\"extraBedType\": 1,\"isFree\": false,\"fee\": {\"amountCent\": 999,\"amount\": 9.99,\"currencyCode\": \"EUR\"} }]},{\"rangeFrom\": 4, \"rangeTo\": 12, \"extraBedFeeList\": [ {\"extraBedType\": 0,\"isFree\": true }, {\"extraBedType\": 2,\"isFree\": false,\"fee\": {\"amountCent\": 333,\"amount\": 3.33,\"currencyCode\": \"JPY\"}}]}]}");
XhotelRoomtypeAddResponse rsp = client.execute(req, sessionKey);
System.out.println(rsp.getBody());
ITopClient client = new DefaultTopClient(url, appkey, secret);
XhotelRoomtypeAddRequest req = new XhotelRoomtypeAddRequest();
req.Hid = 100000L;
req.Name = "标准间";
req.MaxOccupancy = 2L;
req.Area = "10";
req.Floor = "3-5层";
req.BedType = "大床";
req.BedSize = "1.8米";
req.Internet = "A";
req.Service = "{\"bar\":false,\"catv\":false,\"ddd\":false,\"idd\":false,\"pubtoilet\":false,\"toilet\":false}";
req.Extend = "空";
req.OuterId = "100000";
req.WindowType = 1L;
req.Srid = 123123L;
req.Vendor = "taobao";
req.OutHid = "123123";
req.Pics = "[{\"url\":\"http://taobao.com/123.jpg\",\"ismain\":\"true\"},{\"url\":\"http://taobao.com/456.jpg\",\"ismain\":\"false\"},{\"url\":\"http://taobao.com/789.jpg\",\"ismain\":\"false\"}]";
req.NameE = "standard room";
req.Operator = "operator";
req.ConnectionType = 1L;
req.BedInfo = "[{ \"main_bed_type\": \"10\", \"sub_bed_type\": [{ \"sub_bed_num\": 1, \"bed_type\": \"0\", \"length\": \"1.8\", \"width\": \"2\" }, { \"sub_bed_num\": 1, \"bed_type\": \"0\", \"length\": \"1.8\", \"width\": \"2\" }] }]";
req.StandardRoomFacilities = "{ \"dataVersion\":\"2.0.0\", \"facilityList\":[ {\"500\":true,\"fee\":true}, {\"501\":true,\"option\":\"1\"}, {\"506\":true,\"mul-option\":[\"1\",\"2\"],\"desc\":\"说明\"}, {\"507\":true,\"desc\":\"说明\"}, {\"509\":true,\"value\":\"12:00\",\"fee\":true}, {\"2\":true,\"list\":[ {\"inDoorType\":\"1\",\"fee\":true}, {\"inDoorType\":\"2\",\"fee\":true} ]}, {\"7\":true,\"list\":[ {\"restaurantType\":\"1\",\"name\":\"品珍中餐厅\"}, {\"restaurantType\":\"2\",\"name\":\"和日式料理\"} ]} ] }";
req.WindowDesc = "{ \"windowType\":1, \"windowTypeDefect\":\"1,2\", \"windowTypeSpecial\":2 }";
req.AddBed = "{ \"addBed\":true, \"fee\":true, \"desc\":\"xxxx\" }";
req.ChildrenPolicy = "{\"isAllowChildren\": true, //是否允许携带儿童\"isAllowSharingBed\": true, //是否允许儿童共用现有床铺\"policySharingBed\": {//儿童共用床铺信息\"maxChildrenCount\": 3, //允许共用现有床铺的最大儿童数量\"rangeFrom\": 0, //允许共用床铺的起始儿童年龄\"rangeTo\": 17 //允许共用床铺的截止儿童年龄},\"limitChildrenAge\": {//酒店允许入住的儿童年龄范围\"maxChildrenAge\": 17, //最大儿童年龄\"minChildrenAge\": 0 //最小儿童年龄},\"policyContent\": \"该酒店欢迎携带儿童入住\", //儿童政策描述\"extraBedDetails\": [{//儿童加床政策详情 \"rangeFrom\": 0, //儿童起始年龄 \"rangeTo\": 3, //儿童截止年龄 \"extraBedFeeList\": [{\"extraBedType\": 0, //加床类型\"isFree\": false, //是否免费\"fee\": { //费用\"amountCent\": 999, //原始外币报价金额(分)\"amount\": 9.99, //原始外币报价金额(元)\"currencyCode\": \"CNY\"//币种代码}}, {\"extraBedType\": 1,\"isFree\": false,\"fee\": {\"amountCent\": 999,\"amount\": 9.99,\"currencyCode\": \"EUR\"} }]},{\"rangeFrom\": 4, \"rangeTo\": 12, \"extraBedFeeList\": [ {\"extraBedType\": 0,\"isFree\": true }, {\"extraBedType\": 2,\"isFree\": false,\"fee\": {\"amountCent\": 333,\"amount\": 3.33,\"currencyCode\": \"JPY\"}}]}]}";
XhotelRoomtypeAddResponse rsp = client.Execute(req, sessionKey);
Console.WriteLine(rsp.Body);
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new XhotelRoomtypeAddRequest;
$req->setHid("100000");
$req->setName("标准间");
$req->setMaxOccupancy("2");
$req->setArea("10");
$req->setFloor("3-5层");
$req->setBedType("大床");
$req->setBedSize("1.8米");
$req->setInternet("A");
$req->setService("{\"bar\":false,\"catv\":false,\"ddd\":false,\"idd\":false,\"pubtoilet\":false,\"toilet\":false}");
$req->setExtend("空");
$req->setOuterId("100000");
$req->setWindowType("1");
$req->setSrid("123123");
$req->setVendor("taobao");
$req->setOutHid("123123");
$req->setPics("[{\"url\":\"http://taobao.com/123.jpg\",\"ismain\":\"true\"},{\"url\":\"http://taobao.com/456.jpg\",\"ismain\":\"false\"},{\"url\":\"http://taobao.com/789.jpg\",\"ismain\":\"false\"}]");
$req->setNameE("standard room");
$req->setOperator("operator");
$req->setConnectionType("1");
$req->setBedInfo("[{ \"main_bed_type\": \"10\", \"sub_bed_type\": [{ \"sub_bed_num\": 1, \"bed_type\": \"0\", \"length\": \"1.8\", \"width\": \"2\" }, { \"sub_bed_num\": 1, \"bed_type\": \"0\", \"length\": \"1.8\", \"width\": \"2\" }] }]");
$req->setStandardRoomFacilities("{ \"dataVersion\":\"2.0.0\", \"facilityList\":[ {\"500\":true,\"fee\":true}, {\"501\":true,\"option\":\"1\"}, {\"506\":true,\"mul-option\":[\"1\",\"2\"],\"desc\":\"说明\"}, {\"507\":true,\"desc\":\"说明\"}, {\"509\":true,\"value\":\"12:00\",\"fee\":true}, {\"2\":true,\"list\":[ {\"inDoorType\":\"1\",\"fee\":true}, {\"inDoorType\":\"2\",\"fee\":true} ]}, {\"7\":true,\"list\":[ {\"restaurantType\":\"1\",\"name\":\"品珍中餐厅\"}, {\"restaurantType\":\"2\",\"name\":\"和日式料理\"} ]} ] }");
$req->setWindowDesc("{ \"windowType\":1, \"windowTypeDefect\":\"1,2\", \"windowTypeSpecial\":2 }");
$req->setAddBed("{ \"addBed\":true, \"fee\":true, \"desc\":\"xxxx\" }");
$req->setChildrenPolicy("{\"isAllowChildren\": true, //是否允许携带儿童\"isAllowSharingBed\": true, //是否允许儿童共用现有床铺\"policySharingBed\": {//儿童共用床铺信息\"maxChildrenCount\": 3, //允许共用现有床铺的最大儿童数量\"rangeFrom\": 0, //允许共用床铺的起始儿童年龄\"rangeTo\": 17 //允许共用床铺的截止儿童年龄},\"limitChildrenAge\": {//酒店允许入住的儿童年龄范围\"maxChildrenAge\": 17, //最大儿童年龄\"minChildrenAge\": 0 //最小儿童年龄},\"policyContent\": \"该酒店欢迎携带儿童入住\", //儿童政策描述\"extraBedDetails\": [{//儿童加床政策详情 \"rangeFrom\": 0, //儿童起始年龄 \"rangeTo\": 3, //儿童截止年龄 \"extraBedFeeList\": [{\"extraBedType\": 0, //加床类型\"isFree\": false, //是否免费\"fee\": { //费用\"amountCent\": 999, //原始外币报价金额(分)\"amount\": 9.99, //原始外币报价金额(元)\"currencyCode\": \"CNY\"//币种代码}}, {\"extraBedType\": 1,\"isFree\": false,\"fee\": {\"amountCent\": 999,\"amount\": 9.99,\"currencyCode\": \"EUR\"} }]},{\"rangeFrom\": 4, \"rangeTo\": 12, \"extraBedFeeList\": [ {\"extraBedType\": 0,\"isFree\": true }, {\"extraBedType\": 2,\"isFree\": false,\"fee\": {\"amountCent\": 333,\"amount\": 3.33,\"currencyCode\": \"JPY\"}}]}]}");
$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.roomtype.add' \
-d 'partner_id=apidoc' \
-d 'session=e58d3de2-ca50-435d-bcb2-38c3afca8644' \
-d 'sign=C354723ED1B0E3324C81415F89F26AEB' \
-d 'sign_method=hmac' \
-d 'timestamp=2024-12-04+01%3A46%3A38' \
-d 'v=2.0' \
-d 'add_bed=%7B+%5C%22addBed%5C%22%3Atrue%2C+%5C%22fee%5C%22%3Atrue%2C+%5C%22desc%5C%22%3A%5C%22xxxx%5C%22+%7D' \
-d 'area=10' \
-d 'bed_info=%7B+%22main_bed_type%22%3A+%2210%22%2C+%22sub_bed_type%22%3A+%5B%7B+%22sub_bed_num%22%3A+1%2C+%22bed_type%22%3A+%220%22%2C+%22length%22%3A+%221.8%22%2C+%22width%22%3A+%222%22+%7D%2C+%7B+%22sub_bed_num%22%3A+1%2C+%22bed_type%22%3A+%220%22%2C+%22length%22%3A+%221.8%22%2C+%22width%22%3A+%222%22+%7D%5D+%7D' \
-d 'bed_size=1.8%E7%B1%B3' \
-d 'bed_type=%E5%A4%A7%E5%BA%8A' \
-d 'children_policy=%7B%5C%22isAllowChildren%5C%22%3A+true%2C+%2F%2F%E6%98%AF%E5%90%A6%E5%85%81%E8%AE%B8%E6%90%BA%E5%B8%A6%E5%84%BF%E7%AB%A5%5C%22isAllowSharingBed%5C%22%3A+true%2C+%2F%2F%E6%98%AF%E5%90%A6%E5%85%81%E8%AE%B8%E5%84%BF%E7%AB%A5%E5%85%B1%E7%94%A8%E7%8E%B0%E6%9C%89%E5%BA%8A%E9%93%BA%5C%22policySharingBed%5C%22%3A+%7B%2F%2F%E5%84%BF%E7%AB%A5%E5%85%B1%E7%94%A8%E5%BA%8A%E9%93%BA%E4%BF%A1%E6%81%AF%5C%22maxChildrenCount%5C%22%3A+3%2C+%2F%2F%E5%85%81%E8%AE%B8%E5%85%B1%E7%94%A8%E7%8E%B0%E6%9C%89%E5%BA%8A%E9%93%BA%E7%9A%84%E6%9C%80%E5%A4%A7%E5%84%BF%E7%AB%A5%E6%95%B0%E9%87%8F%5C%22rangeFrom%5C%22%3A+0%2C+%2F%2F%E5%85%81%E8%AE%B8%E5%85%B1%E7%94%A8%E5%BA%8A%E9%93%BA%E7%9A%84%E8%B5%B7%E5%A7%8B%E5%84%BF%E7%AB%A5%E5%B9%B4%E9%BE%84%5C%22rangeTo%5C%22%3A+17+%2F%2F%E5%85%81%E8%AE%B8%E5%85%B1%E7%94%A8%E5%BA%8A%E9%93%BA%E7%9A%84%E6%88%AA%E6%AD%A2%E5%84%BF%E7%AB%A5%E5%B9%B4%E9%BE%84%7D%2C%5C%22limitChildrenAge%5C%22%3A+%7B%2F%2F%E9%85%92%E5%BA%97%E5%85%81%E8%AE%B8%E5%85%A5%E4%BD%8F%E7%9A%84%E5%84%BF%E7%AB%A5%E5%B9%B4%E9%BE%84%E8%8C%83%E5%9B%B4%5C%22maxChildrenAge%5C%22%3A+17%2C+%2F%2F%E6%9C%80%E5%A4%A7%E5%84%BF%E7%AB%A5%E5%B9%B4%E9%BE%84%5C%22minChildrenAge%5C%22%3A+0+%2F%2F%E6%9C%80%E5%B0%8F%E5%84%BF%E7%AB%A5%E5%B9%B4%E9%BE%84%7D%2C%5C%22policyContent%5C%22%3A+%5C%22%E8%AF%A5%E9%85%92%E5%BA%97%E6%AC%A2%E8%BF%8E%E6%90%BA%E5%B8%A6%E5%84%BF%E7%AB%A5%E5%85%A5%E4%BD%8F%5C%22%2C+%2F%2F%E5%84%BF%E7%AB%A5%E6%94%BF%E7%AD%96%E6%8F%8F%E8%BF%B0%5C%22extraBedDetails%5C%22%3A+%5B%7B%2F%2F%E5%84%BF%E7%AB%A5%E5%8A%A0%E5%BA%8A%E6%94%BF%E7%AD%96%E8%AF%A6%E6%83%85++%5C%22rangeFrom%5C%22%3A+0%2C+%2F%2F%E5%84%BF%E7%AB%A5%E8%B5%B7%E5%A7%8B%E5%B9%B4%E9%BE%84++%5C%22rangeTo%5C%22%3A+3%2C+%2F%2F%E5%84%BF%E7%AB%A5%E6%88%AA%E6%AD%A2%E5%B9%B4%E9%BE%84++%5C%22extraBedFeeList%5C%22%3A+%5B%7B%5C%22extraBedType%5C%22%3A+0%2C+%2F%2F%E5%8A%A0%E5%BA%8A%E7%B1%BB%E5%9E%8B%5C%22isFree%5C%22%3A+false%2C+%2F%2F%E6%98%AF%E5%90%A6%E5%85%8D%E8%B4%B9%5C%22fee%5C%22%3A+%7B+%2F%2F%E8%B4%B9%E7%94%A8%5C%22amountCent%5C%22%3A+999%2C+%2F%2F%E5%8E%9F%E5%A7%8B%E5%A4%96%E5%B8%81%E6%8A%A5%E4%BB%B7%E9%87%91%E9%A2%9D%EF%BC%88%E5%88%86%EF%BC%89%5C%22amount%5C%22%3A+9.99%2C+%2F%2F%E5%8E%9F%E5%A7%8B%E5%A4%96%E5%B8%81%E6%8A%A5%E4%BB%B7%E9%87%91%E9%A2%9D%EF%BC%88%E5%85%83%EF%BC%89%5C%22currencyCode%5C%22%3A+%5C%22CNY%5C%22%2F%2F%E5%B8%81%E7%A7%8D%E4%BB%A3%E7%A0%81%7D%7D%2C+%7B%5C%22extraBedType%5C%22%3A+1%2C%5C%22isFree%5C%22%3A+false%2C%5C%22fee%5C%22%3A+%7B%5C%22amountCent%5C%22%3A+999%2C%5C%22amount%5C%22%3A+9.99%2C%5C%22currencyCode%5C%22%3A+%5C%22EUR%5C%22%7D+%7D%5D%7D%2C%7B%5C%22rangeFrom%5C%22%3A+4%2C+%5C%22rangeTo%5C%22%3A+12%2C+%5C%22extraBedFeeList%5C%22%3A+%5B+%7B%5C%22extraBedType%5C%22%3A+0%2C%5C%22isFree%5C%22%3A+true+%7D%2C+%7B%5C%22extraBedType%5C%22%3A+2%2C%5C%22isFree%5C%22%3A+false%2C%5C%22fee%5C%22%3A+%7B%5C%22amountCent%5C%22%3A+333%2C%5C%22amount%5C%22%3A+3.33%2C%5C%22currencyCode%5C%22%3A+%5C%22JPY%5C%22%7D%7D%5D%7D%5D%7D' \
-d 'connection_type=1' \
-d 'extend=%E7%A9%BA' \
-d 'floor=3-5%E5%B1%82' \
-d 'hid=100000' \
-d 'internet=A' \
-d 'max_occupancy=2' \
-d 'name=%E6%A0%87%E5%87%86%E9%97%B4' \
-d 'name_e=standard+room' \
-d 'operator=operator' \
-d 'out_hid=123123' \
-d 'outer_id=100000' \
-d 'pics=%7B%22url%22%3A%22http%3A%2F%2Ftaobao.com%2F123.jpg%22%2C%22ismain%22%3A%22true%22%7D%2C%7B%22url%22%3A%22http%3A%2F%2Ftaobao.com%2F456.jpg%22%2C%22ismain%22%3A%22false%22%7D%2C%7B%22url%22%3A%22http%3A%2F%2Ftaobao.com%2F789.jpg%22%2C%22ismain%22%3A%22false%22%7D' \
-d 'service=%7B%5C%22bar%5C%22%3Afalse%2C%5C%22catv%5C%22%3Afalse%2C%5C%22ddd%5C%22%3Afalse%2C%5C%22idd%5C%22%3Afalse%2C%5C%22pubtoilet%5C%22%3Afalse%2C%5C%22toilet%5C%22%3Afalse%7D' \
-d 'srid=123123' \
-d 'standard_room_facilities=%7B+++%5C%22dataVersion%5C%22%3A%5C%222.0.0%5C%22%2C+++%5C%22facilityList%5C%22%3A%5B+++++%7B%5C%22500%5C%22%3Atrue%2C%5C%22fee%5C%22%3Atrue%7D%2C+++++%7B%5C%22501%5C%22%3Atrue%2C%5C%22option%5C%22%3A%5C%221%5C%22%7D%2C+++++%7B%5C%22506%5C%22%3Atrue%2C%5C%22mul-option%5C%22%3A%5B%5C%221%5C%22%2C%5C%222%5C%22%5D%2C%5C%22desc%5C%22%3A%5C%22%E8%AF%B4%E6%98%8E%5C%22%7D%2C+++++%7B%5C%22507%5C%22%3Atrue%2C%5C%22desc%5C%22%3A%5C%22%E8%AF%B4%E6%98%8E%5C%22%7D%2C+++++%7B%5C%22509%5C%22%3Atrue%2C%5C%22value%5C%22%3A%5C%2212%3A00%5C%22%2C%5C%22fee%5C%22%3Atrue%7D%2C+++++%7B%5C%222%5C%22%3Atrue%2C%5C%22list%5C%22%3A%5B+++++++%7B%5C%22inDoorType%5C%22%3A%5C%221%5C%22%2C%5C%22fee%5C%22%3Atrue%7D%2C+++++++%7B%5C%22inDoorType%5C%22%3A%5C%222%5C%22%2C%5C%22fee%5C%22%3Atrue%7D+++++%5D%7D%2C+++++%7B%5C%227%5C%22%3Atrue%2C%5C%22list%5C%22%3A%5B+++++++%7B%5C%22restaurantType%5C%22%3A%5C%221%5C%22%2C%5C%22name%5C%22%3A%5C%22%E5%93%81%E7%8F%8D%E4%B8%AD%E9%A4%90%E5%8E%85%5C%22%7D%2C+++++++%7B%5C%22restaurantType%5C%22%3A%5C%222%5C%22%2C%5C%22name%5C%22%3A%5C%22%E5%92%8C%E6%97%A5%E5%BC%8F%E6%96%99%E7%90%86%5C%22%7D+++++%5D%7D+++%5D+%7D' \
-d 'vendor=taobao' \
-d 'window_desc=%7B+%5C%22windowType%5C%22%3A1%2C+%5C%22windowTypeDefect%5C%22%3A%5C%221%2C2%5C%22%2C+%5C%22windowTypeSpecial%5C%22%3A2+%7D' \
-d 'window_type=1'
# -*- coding: utf-8 -*-
import top.api
req=top.api.XhotelRoomtypeAddRequest(url,port)
req.set_app_info(top.appinfo(appkey,secret))
req.hid=100000
req.name="标准间"
req.max_occupancy=2
req.area="10"
req.floor="3-5层"
req.bed_type="大床"
req.bed_size="1.8米"
req.internet="A"
req.service="{\"bar\":false,\"catv\":false,\"ddd\":false,\"idd\":false,\"pubtoilet\":false,\"toilet\":false}"
req.extend="空"
req.outer_id="100000"
req.window_type=1
req.srid=123123
req.vendor="taobao"
req.out_hid="123123"
req.pics="[{\"url\":\"http://taobao.com/123.jpg\",\"ismain\":\"true\"},{\"url\":\"http://taobao.com/456.jpg\",\"ismain\":\"false\"},{\"url\":\"http://taobao.com/789.jpg\",\"ismain\":\"false\"}]"
req.name_e="standard room"
req.operator="operator"
req.connection_type=1
req.bed_info="[{ \"main_bed_type\": \"10\", \"sub_bed_type\": [{ \"sub_bed_num\": 1, \"bed_type\": \"0\", \"length\": \"1.8\", \"width\": \"2\" }, { \"sub_bed_num\": 1, \"bed_type\": \"0\", \"length\": \"1.8\", \"width\": \"2\" }] }]"
req.standard_room_facilities="{ \"dataVersion\":\"2.0.0\", \"facilityList\":[ {\"500\":true,\"fee\":true}, {\"501\":true,\"option\":\"1\"}, {\"506\":true,\"mul-option\":[\"1\",\"2\"],\"desc\":\"说明\"}, {\"507\":true,\"desc\":\"说明\"}, {\"509\":true,\"value\":\"12:00\",\"fee\":true}, {\"2\":true,\"list\":[ {\"inDoorType\":\"1\",\"fee\":true}, {\"inDoorType\":\"2\",\"fee\":true} ]}, {\"7\":true,\"list\":[ {\"restaurantType\":\"1\",\"name\":\"品珍中餐厅\"}, {\"restaurantType\":\"2\",\"name\":\"和日式料理\"} ]} ] }"
req.window_desc="{ \"windowType\":1, \"windowTypeDefect\":\"1,2\", \"windowTypeSpecial\":2 }"
req.add_bed="{ \"addBed\":true, \"fee\":true, \"desc\":\"xxxx\" }"
req.children_policy="{\"isAllowChildren\": true, //是否允许携带儿童\"isAllowSharingBed\": true, //是否允许儿童共用现有床铺\"policySharingBed\": {//儿童共用床铺信息\"maxChildrenCount\": 3, //允许共用现有床铺的最大儿童数量\"rangeFrom\": 0, //允许共用床铺的起始儿童年龄\"rangeTo\": 17 //允许共用床铺的截止儿童年龄},\"limitChildrenAge\": {//酒店允许入住的儿童年龄范围\"maxChildrenAge\": 17, //最大儿童年龄\"minChildrenAge\": 0 //最小儿童年龄},\"policyContent\": \"该酒店欢迎携带儿童入住\", //儿童政策描述\"extraBedDetails\": [{//儿童加床政策详情 \"rangeFrom\": 0, //儿童起始年龄 \"rangeTo\": 3, //儿童截止年龄 \"extraBedFeeList\": [{\"extraBedType\": 0, //加床类型\"isFree\": false, //是否免费\"fee\": { //费用\"amountCent\": 999, //原始外币报价金额(分)\"amount\": 9.99, //原始外币报价金额(元)\"currencyCode\": \"CNY\"//币种代码}}, {\"extraBedType\": 1,\"isFree\": false,\"fee\": {\"amountCent\": 999,\"amount\": 9.99,\"currencyCode\": \"EUR\"} }]},{\"rangeFrom\": 4, \"rangeTo\": 12, \"extraBedFeeList\": [ {\"extraBedType\": 0,\"isFree\": true }, {\"extraBedType\": 2,\"isFree\": false,\"fee\": {\"amountCent\": 333,\"amount\": 3.33,\"currencyCode\": \"JPY\"}}]}]}"
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.roomtype.add");
add_param(pRequest,"hid","100000");
add_param(pRequest,"name","标准间");
add_param(pRequest,"max_occupancy","2");
add_param(pRequest,"area","10");
add_param(pRequest,"floor","3-5层");
add_param(pRequest,"bed_type","大床");
add_param(pRequest,"bed_size","1.8米");
add_param(pRequest,"internet","A");
add_param(pRequest,"service","{\"bar\":false,\"catv\":false,\"ddd\":false,\"idd\":false,\"pubtoilet\":false,\"toilet\":false}");
add_param(pRequest,"extend","空");
add_param(pRequest,"outer_id","100000");
add_param(pRequest,"window_type","1");
add_param(pRequest,"srid","123123");
add_param(pRequest,"vendor","taobao");
add_param(pRequest,"out_hid","123123");
add_param(pRequest,"pics","{"url":"http://taobao.com/123.jpg","ismain":"true"},{"url":"http://taobao.com/456.jpg","ismain":"false"},{"url":"http://taobao.com/789.jpg","ismain":"false"}");
add_param(pRequest,"name_e","standard room");
add_param(pRequest,"operator","operator");
add_param(pRequest,"connection_type","1");
add_param(pRequest,"bed_info","{ "main_bed_type": "10", "sub_bed_type": [{ "sub_bed_num": 1, "bed_type": "0", "length": "1.8", "width": "2" }, { "sub_bed_num": 1, "bed_type": "0", "length": "1.8", "width": "2" }] }");
add_param(pRequest,"standard_room_facilities","{ \"dataVersion\":\"2.0.0\", \"facilityList\":[ {\"500\":true,\"fee\":true}, {\"501\":true,\"option\":\"1\"}, {\"506\":true,\"mul-option\":[\"1\",\"2\"],\"desc\":\"说明\"}, {\"507\":true,\"desc\":\"说明\"}, {\"509\":true,\"value\":\"12:00\",\"fee\":true}, {\"2\":true,\"list\":[ {\"inDoorType\":\"1\",\"fee\":true}, {\"inDoorType\":\"2\",\"fee\":true} ]}, {\"7\":true,\"list\":[ {\"restaurantType\":\"1\",\"name\":\"品珍中餐厅\"}, {\"restaurantType\":\"2\",\"name\":\"和日式料理\"} ]} ] }");
add_param(pRequest,"window_desc","{ \"windowType\":1, \"windowTypeDefect\":\"1,2\", \"windowTypeSpecial\":2 }");
add_param(pRequest,"add_bed","{ \"addBed\":true, \"fee\":true, \"desc\":\"xxxx\" }");
add_param(pRequest,"children_policy","{\"isAllowChildren\": true, //是否允许携带儿童\"isAllowSharingBed\": true, //是否允许儿童共用现有床铺\"policySharingBed\": {//儿童共用床铺信息\"maxChildrenCount\": 3, //允许共用现有床铺的最大儿童数量\"rangeFrom\": 0, //允许共用床铺的起始儿童年龄\"rangeTo\": 17 //允许共用床铺的截止儿童年龄},\"limitChildrenAge\": {//酒店允许入住的儿童年龄范围\"maxChildrenAge\": 17, //最大儿童年龄\"minChildrenAge\": 0 //最小儿童年龄},\"policyContent\": \"该酒店欢迎携带儿童入住\", //儿童政策描述\"extraBedDetails\": [{//儿童加床政策详情 \"rangeFrom\": 0, //儿童起始年龄 \"rangeTo\": 3, //儿童截止年龄 \"extraBedFeeList\": [{\"extraBedType\": 0, //加床类型\"isFree\": false, //是否免费\"fee\": { //费用\"amountCent\": 999, //原始外币报价金额(分)\"amount\": 9.99, //原始外币报价金额(元)\"currencyCode\": \"CNY\"//币种代码}}, {\"extraBedType\": 1,\"isFree\": false,\"fee\": {\"amountCent\": 999,\"amount\": 9.99,\"currencyCode\": \"EUR\"} }]},{\"rangeFrom\": 4, \"rangeTo\": 12, \"extraBedFeeList\": [ {\"extraBedType\": 0,\"isFree\": true }, {\"extraBedType\": 2,\"isFree\": false,\"fee\": {\"amountCent\": 333,\"amount\": 3.33,\"currencyCode\": \"JPY\"}}]}]}");
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.roomtype.add', {
'hid':'100000',
'name':'标准间',
'max_occupancy':'2',
'area':'10',
'floor':'3-5层',
'bed_type':'大床',
'bed_size':'1.8米',
'internet':'A',
'service':'{\"bar\":false,\"catv\":false,\"ddd\":false,\"idd\":false,\"pubtoilet\":false,\"toilet\":false}',
'extend':'空',
'outer_id':'100000',
'window_type':'1',
'srid':'123123',
'vendor':'taobao',
'out_hid':'123123',
'pics':'{"url":"http://taobao.com/123.jpg","ismain":"true"},{"url":"http://taobao.com/456.jpg","ismain":"false"},{"url":"http://taobao.com/789.jpg","ismain":"false"}',
'name_e':'standard room',
'operator':'operator',
'connection_type':'1',
'bed_info':'{ "main_bed_type": "10", "sub_bed_type": [{ "sub_bed_num": 1, "bed_type": "0", "length": "1.8", "width": "2" }, { "sub_bed_num": 1, "bed_type": "0", "length": "1.8", "width": "2" }] }',
'standard_room_facilities':'{ \"dataVersion\":\"2.0.0\", \"facilityList\":[ {\"500\":true,\"fee\":true}, {\"501\":true,\"option\":\"1\"}, {\"506\":true,\"mul-option\":[\"1\",\"2\"],\"desc\":\"说明\"}, {\"507\":true,\"desc\":\"说明\"}, {\"509\":true,\"value\":\"12:00\",\"fee\":true}, {\"2\":true,\"list\":[ {\"inDoorType\":\"1\",\"fee\":true}, {\"inDoorType\":\"2\",\"fee\":true} ]}, {\"7\":true,\"list\":[ {\"restaurantType\":\"1\",\"name\":\"品珍中餐厅\"}, {\"restaurantType\":\"2\",\"name\":\"和日式料理\"} ]} ] }',
'window_desc':'{ \"windowType\":1, \"windowTypeDefect\":\"1,2\", \"windowTypeSpecial\":2 }',
'add_bed':'{ \"addBed\":true, \"fee\":true, \"desc\":\"xxxx\" }',
'children_policy':'{\"isAllowChildren\": true, //是否允许携带儿童\"isAllowSharingBed\": true, //是否允许儿童共用现有床铺\"policySharingBed\": {//儿童共用床铺信息\"maxChildrenCount\": 3, //允许共用现有床铺的最大儿童数量\"rangeFrom\": 0, //允许共用床铺的起始儿童年龄\"rangeTo\": 17 //允许共用床铺的截止儿童年龄},\"limitChildrenAge\": {//酒店允许入住的儿童年龄范围\"maxChildrenAge\": 17, //最大儿童年龄\"minChildrenAge\": 0 //最小儿童年龄},\"policyContent\": \"该酒店欢迎携带儿童入住\", //儿童政策描述\"extraBedDetails\": [{//儿童加床政策详情 \"rangeFrom\": 0, //儿童起始年龄 \"rangeTo\": 3, //儿童截止年龄 \"extraBedFeeList\": [{\"extraBedType\": 0, //加床类型\"isFree\": false, //是否免费\"fee\": { //费用\"amountCent\": 999, //原始外币报价金额(分)\"amount\": 9.99, //原始外币报价金额(元)\"currencyCode\": \"CNY\"//币种代码}}, {\"extraBedType\": 1,\"isFree\": false,\"fee\": {\"amountCent\": 999,\"amount\": 9.99,\"currencyCode\": \"EUR\"} }]},{\"rangeFrom\": 4, \"rangeTo\": 12, \"extraBedFeeList\": [ {\"extraBedType\": 0,\"isFree\": true }, {\"extraBedType\": 2,\"isFree\": false,\"fee\": {\"amountCent\": 333,\"amount\": 3.33,\"currencyCode\": \"JPY\"}}]}]}'
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})