萨比SDK
SDK 为搜索提供高水平的TypeScript/JavaScript API 酒店 酒店的报价和房间.
目录
- 萨比SDK
- 目录
- 释放过程
- 教学
- API 参考
释放过程
SAP SDK没有连续的集成/交付. 合并 PR 进入主分支不会自动触发释放过程. 对于 释放 SAPI SDK 用途 船舶.js 工具。 它赋予了更多的控制过程。 船舶.js自动 在发布每版前创建 PR, 因此允许 :
- 确认下一个版本正确 .
- 确认哪些承诺将被释放,并与 同事们.
- 编辑自动生成的更改日志, 以澄清( I) 可读性.
国家防范机制
释放前(beta)程序需要国家预防机制账户:
- 转到 国家防范机制报名
- 创建账户并请求 SAPI 允许您访问组织
- 使用认证人/1 Password 激活您的两个因素认证
GitHub 托肯语Name
发布过程需要 GitHub 令牌 :
- 转到 您的 GitHub 账户
- 检查“ repo( 完全控制私人仓库) ”
- 生成/复制符号
- 在命令行中添加如下:
GITHUB_TOKEN=xxx
新发行
要创建和部署 SAPI SDK 新版本, 请跟随下一个版本 步骤 :
- 合并您的更改 。 一次发布会有多个变化
- 检查最新版本
main分支 - 在根目录运行中
make release命令 - 此 将启动释放进程 - 审查和确认(或更改)新版本编号
- 安装依赖关系和运行部署脚本后,将新建 将自动创建拉动请求
- 审查/更新
CHANGELOG.md在根目录中。 记下来 使用描述更改 保留更改日志 指导 原则,并将您的更改输入新建的版本 公关 - 审查PR/任务SAPI工程师供批准
Squash and merge公关。 这将启动自动 使用 GitHub 动作发布进程,并在一段时间后发布新进程 将发布到 NMP- 检查新版本是否已发布给国家预防机制
开发处新发行
有时 您可能想要在网站上测试您的更改, 例如本地或自定义/ 测试环境, 然后再将您的分支合并为主, 然后再制作一个新的 SAPI SDK 版本 。 为此,您可以创建并发布预释.
发行前向国家预防机制发布新版本,标签除外 latest (默认标记).
要发布预发本,请遵循下一步:
-
从项目根部构建 SAPI SDK :
make core-build -
创建新版本
npm version prepatch (preminor, premajor) --preid=beta (alpha, beta, etc...)数字 :npm version prepatch --preid=beta这会导致这样的事情
1.4.1-beta.0-
如果你已经发布了一个预发版,并且想要增加版本的预发部分,运行:
npm version prerelease这会导致这样的事情
1.4.1-beta.1
-
-
使用非标签发布更改
latest数字 :npm publish --tag=next在发布期间, 您会请求登录/ 输入您的 OTP( Two Factor Auth Code) , 您可以使用 Auth 程序访问 这里(中文(简体) )
-
在新版本发布到 npm后, 将其安装到指定新版本的本地环境中 :
npm install @findhotel/[email protected]
教学
开始
首先通过 无 软件包管理器 :
npm install @findhotel/sapi
然后,将 SAPI 导入到您的项目中 :
import sapi from "@findhotel/sapi";
创建 SAPI 客户端 :
const profileKey = "profile-key";
const sapiClient = await sapi(profileKey, {
anonymousId: "fd9dbb5f-b337-4dd7-b640-1f177d1d3caa",
language: "en",
currency: "USD",
userCountry: "US",
});
现在, SAPI 客户端已准备好用于您的应用程序 .
完整文档和辅助选项检查 客户端 api。 。 。 .
原生反应
使用 Sapi SDK 软件 uuid 用于生成随机字符串.
uuid 使用全局 crypto 对象不是
可在本地环境中使用.
为了增加支持, crypto 应在
消费者方面。 我们建议安装
crypto.getRandomValues 不使用其他的多填充
crypto 方法。 。 。 有关多填充的更多信息
已找到 这里
游戏场
Playground 是一个本地环境,用于检查您的更改, 并测试执行是否正确, 您可以通过打开两个终端并运行这些命令来访问本地环境( http://localhost: 3: 00)
# watch your changes to core and create a new bundle
make core-dev
# runs the playground on http://localhost:3000
make playground-run
使用量
搜索
寻找酒店和酒店的报价:
const searchParameters = {
placeId: "47319",
checkIn: "2021-10-10",
checkOut: "2021-10-11",
rooms: "2",
};
const callbacks = {
onStart: (response) => {
log("Search started", response);
},
onAnchorReceived: (response) => {
log("Anchor received", response);
},
onHotelsReceived: (response) => {
log("Hotels received", response);
},
onOffersReceived: (response) => {
log("Offers received", response);
},
onComplete: (response) => {
log("Search completed", response);
},
};
const search = await sapiClient.search(searchParameters, callbacks);
完整文档请检查 搜索方法 api。 。 。 .
买酒店的房间
获取房间数据和房间的报价:
const rooms = await sapiClient.rooms({
hotelId: "47319",
checkIn: "2021-10-10",
checkOut: "2021-10-11",
rooms: "2",
});
我们还介绍 roomsV2 即使古人堕落 rooms 方法
const rooms = await sapiClient.roomsV2({
hotelId: "47319",
checkIn: "2021-10-10",
checkOut: "2021-10-11",
rooms: "2",
});
完整文档请检查 房间方法 api。 。 。 .
去旅馆
把酒店的号码:
const hotel = await sapiClient.hotel("1196472");
完整文档请检查 旅馆方法 api。 。 。 .
去旅馆
给酒店打个电话:
const hotels = await sapiClient.hotels(["1714808", "1380416", "1710829"]);
完整文档请检查 旅馆方法 api。 。 。 .
买酒店
获得单家酒店的报价:
const parameters = {
hotelId: "1196472",
};
const callbacks = {
onStart: (response) => {
log("Offers started", response);
},
onOffersReceived: (response) => {
log("Offers received", response);
},
onComplete: (response) => {
log("Offers completed", response);
},
};
const offers = await sapiClient.offers(parameters, callbacks);
完整文档请检查 提供方法 api。 。 。 .
得到酒店报价
获得多个酒店的报价:
const parameters = {
hotelIds: ["1196472", "1041597"],
};
const callbacks = {
onStart: (response) => {
log("Hotels offers started", response);
},
onOffersReceived: (response) => {
log("Hotels offers received", response);
},
onComplete: (response) => {
log("Hotels offers completed", response);
},
};
const offers = await sapiClient.hotelsOffers(parameters, callbacks);
完整文档请检查 旅馆提供方法api。 。 。 .
获得旅馆可用性(价目表)
获得酒店服务:
const parameters = {
hotelIds: ["1380416", "1359951"],
startDate: "2023-08-05",
endDate: "2023-08-12",
nights: 2,
rooms: "2",
};
const callbacks = {
onStart: (response) => {
log("Availability request started", response);
},
onAvailabilityReceived: (response) => {
log("Availability received", response);
},
onComplete: (response) => {
log("Availability completed", response);
},
};
const response = await sapiClient.hotelAvailability(parameters, callbacks);
完整文档请检查 可用方法 api。 。 。 .
API 参考
SAPI 客户端
创建 SAPI 客户端 :
const profileKey = "profile-key";
const sapiClient = await sapi(profileKey, {
anonymousId: "fd9dbb5f-b337-4dd7-b640-1f177d1d3caa",
language: "en",
currency: "USD",
userCountry: "US",
deviceType: "mobile",
pageSize: 20,
initWithAppConfig: {},
callbacks: {
onConfigReceived: (config) => {
log("Config received", config);
},
},
getTotalRate: (rate) => {
let totalRate = rate.base;
if (includeTaxes) totalRate += rate.taxes;
if (includeHotelFees) totalRate += rate.hotelFees;
return totalRate;
},
apiKey: "sk_test_123456789",
});
支持的选项
| 名称 | 所需经费 | 类型 | 默认 | 说明 | 实例 |
|---|---|---|---|---|---|
anonymousId | 对 | string | 独特的ID识别用户 | 2d360284-577b-4a53-8b91-68f72b9227fa | |
language | 没有 | string | en | 2-char 语言代码 | en |
currency | 没有 | string | USD | 3- Char 大写 ISO 货币代码 | USD |
userCountry | 没有 | string | US | 2-char 大写 ISO 国家代码 | US |
deviceType | 对 | string | desktop, (中文(简体) ), mobile, (中文(简体) ), tablet | desktop | |
pageSize | 没有 | number | 20 | 显示的页面大小 | 20 |
initWithAppConfig | 没有 | AppConfig | 外部应用程序配置以覆盖内部 | ||
variations | 没有 | Record<string, string> | A/B测试变化 | {'pp000004-tags2': 'b', 'pp000004-tags3': '1'} | |
callbacks | 没有 | Record<string, fnc> | 客户调用 | ||
getTotalRate | 没有 | function | 税率共计,包括税费 | 基于税务显示逻辑计算总显示率的函数 。 用于价格过滤和按价格功能排序. | |
apiKey | 没有 | string | 为 SAPI 后端验证请求的 API 密钥 。 每个客户端都有自己独特的密钥被存储在sapi-backend配置来识别请求源. | sk_test_123456789 | |
forcedRegion | 没有 | 'eu' | 'us' | SAPI部队通过发送 X-Sapi-Region 头曰. | eu |
可用的客户端回调
-
已接收( 配置) 上
返回 sapiClient 使用的配置设置.
回应
{
"exchangeRates": {
"EUR": 0.982994
},
"lov": [
{
"id": 9,
"categoryID": 19,
"objectID": "Facility:9",
"value": {
"en": "Airport shuttle"
}
},
{
"categoryID": 2,
"id": 7,
"objectID": "Facility:7",
"value": {
"en": "Swimming pool"
}
}
]
}
search() 方法
搜索是一种方法 sapi 客户端 搜索旅馆和提供
提供 searchParameters数字 :
const search = await sapiClient.search(searchParameters, callbacks);
搜索参数
所有参数都是可选的.
| 名称 | 类型 | 说明 | 实例 |
|---|---|---|---|
hotelId | string | 旅馆 搜查旅馆 | 1371626 |
placeId | string | 地点 搜索地点 | 47319 |
geolocation | {lat: number, lon: number, precision: string} | 地理位置查询 | {lat: 36.114303, lon: -115.178312} |
address | string | 地址搜索字符串 | Nieuwe Looiersdwarsstraat 17, |
boundingBox | [p1Lat, p1Lng, p2Lat, p2Lng] | topLeft 财务报告和审定财务报表 bottomRight 进行内部搜索的边框坐标 | [46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625] |
checkIn | string | 检查日期( E)YYYY-MM-DD(中文(简体) ) | 2021-10-10 |
checkOut | string | 检查日期( E)YYYY-MM-DD(中文(简体) ) | 2021-10-11 |
rooms | string | 房间配置 | 2 |
dayDistance | number | 从现在到预期日期的全天检查(工作结合 nights 参数) | 15 |
nights | number | 停留夜数 | 3 |
sortField | string | 按标准定义类型 | popularity, price |
sortOrder | string | 定义排序顺序 | ascending, descending |
filters | Object | 对象为 过滤器 | {starRatings: 5} |
cugDeals | string[] | 获取要约的封闭用户组交易代码 | ['signed_in', 'offline'] |
tier | string | 用户级别 | member |
originId | string | 提出请求的原产地识别符 | c3po6twr70 |
preferredRate | number | 出价用户在 CA (meta) 平台看到 | 196 |
label | string | 传送到跟踪系统的不透明值 | gha-vr |
userId | string | 经认证的用户ID,例如用户的GoogleID. 由ACL使用 | c34b0018-d434-4fad-8de6-9d8e8e18cb35 |
emailDomain | string | 认证用户的电子邮件域名, 由 ACL 使用 | @manatuscostarica.com |
deviceId | string | 设备ID,由ACL使用(iOS设备的以发光器或Android设备的GAID) | |
screenshots | number | 用户拍摄、网站检测、ACL使用的截图数量 | 2 |
metadata | Record<string, string> | 将传送到搜索的其他元数据 | {esd: 'abcds', epv: 'qwert'} |
offerSort | string | 如果存在,按价格分列的要约(见 解释(中文(简体) ) | |
optimizeRooms | boolean | 若为 true 然后对非锚地酒店启用房间优化逻辑. 优化房间试图找到最佳的 可能的房间配置 | true |
optimizeAnchorRooms | boolean | 若为 true 然后,房间优化逻辑被启用 对于锚酒店。 优化房间试图找到最佳的 可能的房间配置 | false |
sbc | string | 拆分预订配置。如果存在,则查找分期预订报价 | sbc: '2~3' |
skipOffers | boolean | 跳过提供搜索, 只返回静态结果 | true |
searchId | string | 搜索会话的ID, 仅在重运行要跟踪的搜索会话时指定 | true |
useLiveOfferDataHSO | boolean | 提示后端何时使用或不使用现场数据,用于精细的酒店分类 | true |
拆分预订配置
LOS1~LOS2
其中:
LOS1 财务报告和审定财务报表 LOS2 是分别代表分期预订第一和第二部分停留时间的整数.
例如,如果我们有这些参数:
checkIn:'2023-08-10'
checkOut:'2023-08-15'
sbc:2~3
分会订会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分会分. 因此,SAPI搜索两个停留:
拆分 1 : checkIn: '2023-08-10' checkOut: '2023-08-12'
拆分 2 : checkIn: '2023-08-12' checkOut: '2023-08-15'
过滤器
| 名称 | 类型 | 说明 | 实例 | 过滤范围 |
|---|---|---|---|---|
themeIds | number[] | 按主题 ID 过滤 | [1, 2, 3] | 旅馆 |
chainIds | number[] | 旅馆连锁身份证 | [4, 5] | 旅馆 |
facilities | string[] | 用于面部过滤的设施标识 | [299,7,6,21] | 旅馆 |
starRatings | number[] | 酒店的明星评分 | [3, 4] | 旅馆 |
propertyTypeId | number[] | 属性类型 ID | [1, 0] | 旅馆 |
guestRating | number | 最低总嘉宾评级 | 5 | 旅馆 |
noHostels | boolean | 如果是真的, 宿舍将被排除在结果之外 | true | 旅馆 |
priceMin | number | 每晚最低价格 | 100 | 旅馆/旅馆 |
priceMax | number | 每晚最高价格 | 200 | 旅馆/旅馆 |
hotelName | string | 根据酒店名称过滤结果 | Hilton Amsterdam | 旅馆 |
freeCancellation | boolean | 如果选中, 只有免费取消的报价才会被退回 | true | 提议 |
payLater | boolean | 如果属实,则只退还有报酬的报价 | true | 提议 |
mealIncluded | boolean | 如果选中的话, 只有包含餐食选项的报价才会返回 | true | 提议 |
dealFreeze | boolean | 如果是真的,只有可以被冻结的报价才会被退回 | true | 提议 |
exclusive | boolean | 如果是真的,只有Vio独有的报价才会退回 | true | 提议 |
amenities | string[] | 餐类 | ["breakfast","allInclusive"] | |
isVr | boolean | 如果是真的,那么只归还假期租金。 假的,就把假期租房过滤掉 | true | 旅馆 |
neighborhoodIds | string[] | 根据酒店的邻居过滤结果 | ["47689","45031"] | 旅馆 |
brandIds | string[] | 根据酒店品牌过滤结果 | ["12060","2137"] | 旅馆 |
设施
一些用于过滤的首选设施:
| 名称 | 编号 |
|---|---|
free_wifi | 299 (中文(简体) ) |
swimming_pool | 第7条 |
restaurant | 页:1 |
parking | 6个 |
pet_friendly | 第8条 |
kitchen | 第50条 |
hot_tub | 页:1 |
spa | 第193条 |
air_conditioned | 21国 |
财产类型
用于过滤的一些属性类型 :
| 名称 | 编号 |
|---|---|
hotel | 0 个 |
apartment | 第9条 |
hostel | 页:1 |
motel | 1个 |
机会
| 名称 | 说明 |
|---|---|
breakfast | |
lunch | |
dinner | |
halfBoard | "快餐",或酒店明确使用"半板"一词 |
fullBoard | "breakfast qq午餐qq晚餐",或酒店明确使用"全板"一词 |
allInclusive | "所有饭吃喝喝" 或酒店明确使用"包罗万象"一词 |
回电
搜索方法接收回调对象作为第二个参数 :
const callbacks = {
onStart: (response) => {
log("Search started", response);
},
onAnchorReceived: (response) => {
log("Anchor received", response);
},
onHotelsReceived: (response) => {
log("Hotels received", response);
},
onOffersReceived: (response) => {
log("Offers received", response);
},
onComplete: (response) => {
log("Search completed", response);
},
};
每个回调返回 SAPI 内部可用的完整搜索状态 死刑时间。 这意味着以后的每个回电 渐进添加新属性并返回更新状态。 数据在 状态可以在不同的召回之间重复.
-
启动时 ()
每次新搜索开始时运行 .
已生成回调
searchId财务报告和审定财务报表 用于搜索的实际搜索参数,如日期, 如果引用者不提供这些语言的话.这种回调的另一个目的是,引用者可以跟踪 在搜索SPA中 旅馆。 。 。 .
-
锁定接收 ()
当SAPI接收主播和(?)主播酒店(如果是酒店)时运行 搜索)
返回关于锚的静态数据response.anchor和(?) 里面的旅馆response.hotelEntities对象( 在 宾馆搜查案). -
在 Hotels 接收( )
SAPI 收到静态搜索结果后运行
返回内部旅馆的静态数据response.hotelEntities目标及适当时 酒店排序顺序response.hotelIds数组( 类型) 根据HSO. -
输入( )
当SAPI收到大量报价时运行
返回旅馆的报价(答复不完整)response.hotelOfferEntities对象及已更新 酒店排序顺序response.hotelIds数组( 类型) 根据健康标准并考虑到实际报价数据)
答复的详细内容载于本文件附件 提供答复 -
完成( )
当前搜索完成后运行, 所有要约都被检索
返回完整的 SAPI 搜索响应 .
答复的详细内容载于本文件附件 提供答复
回应
完整的 SAPI 搜索响应太大, 无法在页面上显示 因此有一个简化的例子:
{
"anchor": {
"_geoloc": {
"lat": -6.28067,
"lon": 39.53601,
"precision": 5000,
"radius": 20000
},
"objectID": "hotel:9660485",
"objectType": "hotel",
"pageSize": 25,
"priceBucketWidth": 16,
"navPath": ["3429", "300878", "235186"],
"navPathInfo": {
"adminDivision": {
"id": "12598",
"name": "Hokkaido Prefecture"
},
"city": {
"id": "43727",
"name": "Otaru"
},
"country": {
"id": "125948",
"name": "Japan"
}
},
"hotelName": "Zanzibar White Sand Luxury Villas & Spa - Relais & Chateaux",
"placeDisplayName": "Zanzibar"
},
"anchorType": "hotel",
"anchorHotelId": "9660485",
"facetFilters": {
"brands": {
"0": {
"value": "Independent"
},
"11157": {
"value": "NH Collection"
},
"12060": {
"value": "Revenue Guru"
}
},
"neighborhoods": {
"253086": {
"value": "Amsterdam City Centre"
},
"305373": {
"value": "Amsterdam-West"
},
"305374": {
"value": "Amsterdam-Zuid"
}
}
},
"hotelEntities": {
"9660485": {
"_geoloc": {
"lat": -6.28067,
"lon": 39.53601
},
"checkInTime": "14:00",
"checkOutTime": "11:00",
"country": "TZ",
"facilities": [
2, 5, 6, 7, 9, 11, 13, 20, 21, 22, 23, 28, 29, 31, 34, 35, 66, 84, 85,
86, 98, 99, 100, 103, 104, 122, 127, 189, 191, 193, 195, 202, 222, 235,
238, 243, 244, 253, 255, 266, 270, 292, 299
],
"guestRating": {
"cleanliness": 9.66,
"dining": 9.42,
"facilities": 9.9,
"location": 9.8,
"overall": 9.55,
"rooms": 9.72
},
"guestType": {
"business": 6,
"couples": 235,
"families": 110,
"groups": 68,
"solo": 13
},
"imageURIs": [
"https://img.fih.io/image/raw/regular/provider_partition=eps/3xWl0k2P0Ofb7vxD4dr1NhFjOtdQaHXLe2p1tYLaOmw=.webp"
],
"navPath": ["3429", "300878", "235186"],
"navPathInfo": {
"adminDivision": {
"id": "12598",
"name": "Hokkaido Prefecture"
},
"city": {
"id": "43727",
"name": "Otaru"
},
"country": {
"id": "125948",
"name": "Japan"
}
}
}
}
}
导航PathInfo
此结构包含有关酒店位置的所有信息(从国家开始 - > 区域 - > 城市 - > 村庄)
"navPathInfo": {
"adminDivision": {
"id": "12598",
"name": "Hokkaido Prefecture"
},
"city": {
"id": "43727",
"name": "Otaru"
},
"country": {
"id": "125948",
"name": "Japan"
}
}
装入更多的结果 并装入更多的报价 酒店
搜索完成后:
const search = await sapiClient.search(searchParameters, callbacks);
它解决在 search 具有两种方法的对象:
search.loadMore()- SDK将返回给定搜索的下一组结果("next" page). 一样 调用 从原始搜索将使用.search.loadOffers(hotelId, {filters, offersSort})- 装载所提供的所有报价(最多23个)hotelId。也可以覆盖 提供范围过滤器 财务报告和审定财务报表 提议排序。 。 。 .
suggest() 方法
建议为给定查询提供自动建议
const suggestions = await sapiClient.suggest("London", 6);
建议参数
| 名称 | 类型 | 说明 | 所需经费 | 实例 |
|---|---|---|---|---|
query | string | 查询字符串 | 对 | London |
suggestsCount | number | 理想建议数目(默认6) | 没有 | 10 |
回应
const suggestions = await sapiClient.suggest("London", 2);
[
{
"highlightValue": "<em>London</em>",
"objectID": "158584",
"objectType": "place",
"placeDisplayName": "United Kingdom",
"placeTypeName": "city",
"value": "London"
},
{
"highlightValue": "<em>London</em> Heathrow Airport",
"objectID": "167733",
"objectType": "place",
"placeDisplayName": "London, United Kingdom",
"placeTypeName": "airport",
"value": "London Heathrow Airport"
}
]
const suggestions = await sapiClient.suggest("London hotel", 2);
[
{
"highlightValue": "Park Plaza Westminster Bridge <em>London</em>",
"objectID": "1546646",
"objectType": "hotel",
"placeDisplayName": "London, United Kingdom",
"placeTypeName": "property",
"value": "Park Plaza Westminster Bridge London"
},
{
"highlightValue": "Hampton by Hilton <em>London</em> Stansted Airport",
"objectID": "3333916",
"objectType": "hotel",
"placeDisplayName": "United Kingdom",
"placeTypeName": "property",
"value": "Hampton by Hilton London Stansted Airport"
}
]
freeTextSuggest() 方法
FreeTextSuggest 提供了基于 AI 特性的给定自由文本查询的建议
const result = await sapiClient.freeTextSuggest(
"5 stars hotels in Amsterdam with pets allowed for tomorrow 2 nights",
);
建议参数
| 名称 | 类型 | 说明 | 所需经费 | 实例 |
|---|---|---|---|---|
query | string | 查询字符串 | 对 | 5 stars hotels in Amsterdam with pets allowed for tomorrow 2 nights |
回应
const result = await sapiClient.freeTextSuggest(
"5 stars hotels in Amsterdam with pets allowed for tomorrow 2 nights",
);
[
{
"filters": {
"starRating": 5,
"facilities": [
{
"id": 8,
"value": "Pet Friendly"
}
]
},
"checkIn": "2024-06-12",
"checkOut": "2024-06-14",
"highlightValue": "<em>Amsterdam</em>",
"objectID": "47319",
"objectType": "place",
"placeDisplayName": "The Netherlands",
"placeTypeName": "city",
"value": "Amsterdam"
},
{
"filters": {
"starRating": 5,
"facilities": [
{
"id": 8,
"value": "Pet Friendly"
}
]
},
"checkIn": "2024-06-12",
"checkOut": "2024-06-14",
"highlightValue": "InterContinental Amstel <em>Amsterdam</em>, an IHG Hotel",
"objectID": "1363313",
"objectType": "hotel",
"placeDisplayName": "Weesperbuurt en Plantage, Amsterdam, The Netherlands",
"placeTypeName": "property",
"value": "InterContinental Amstel Amsterdam, an IHG Hotel"
}
]
rooms() 方法
房间是一种方法 sapi 客户端 用于检索房间信息和 提供某一特定行程:
五一号
const rooms = await sapiClient.rooms({
hotelId: "1714808",
checkIn: "2021-10-10",
checkOut: "2021-10-11",
rooms: "2",
});
五. 2级
const rooms = await sapiClient.roomsV2({
hotelId: "1714808",
checkIn: "2021-10-10",
checkOut: "2021-10-11",
rooms: "2",
});
房间参数
| 名称 | 类型 | 说明 | 所需经费 | 实例 |
|---|---|---|---|---|
hotelId | string | 旅馆 找回房间 | 对 | 1714808 |
checkIn | string | 检查日期( E)YYYY-MM-DD(中文(简体) ) | 对 | 2021-10-10 |
checkOut | string | 检查日期( E)YYYY-MM-DD(中文(简体) ) | 对 | 2021-10-11 |
rooms | string | 房间配置 | 对 | 2 |
providerCode | string | 用于检索房间报价的供应商代码 | 没有 | GAR |
cugDeals | string | 要检索的 cug( 关闭用户组) 交易类型 | 没有 | signed_in,offline |
tier | string | 用户级别 | 没有 | plus |
clickedOfferId | string | 提供用户点击 SRP 的 id | 没有 | oXstvXafDb2o |
preHeat | number | 启用预热模式 | 没有 | 1 |
label | string | 传送到跟踪系统的不透明值 | 没有 | gha-vr |
userId | string | 用户ID是一个认证的用户ID,例如用户的Google ID. | 没有 | 7ea95191-b929-469d-8b02-0397dafd53a1 |
emailDomain | string | 如果有电子邮件,用户电子邮件域是作为值认证的用户. | 没有 | @findhotel.net |
deviceId | string | 设备 ID (iOS 设备的 FFV 或 Android 设备的 GAID ) | 没有 | |
searchId | string | SearchId 覆盖( SDK 如果未提供则生成一个新的覆盖) | 没有 | 08230dfcc5f0fb95caaa82ce559ea60c4a975d6f |
metadata | Record<string, string> | 需要传递给API的其他数据 | 没有 | {vclid: '21d2d152-de19-4f39-b40a-d4bc3002c6e8'} |
bundleId | string | 套装 Id点击了SRP. 用于从缓存获取捆绑数据 | 没有 | 13b5d152-de19-4f39-b40a-d4bc3002c3u9 |
originId | string | 提出请求的原产地识别符 | 没有 | c3po6twr70 |
回应
V1 回应
{
"anonymousId": "fd9dbb5f-b337-4dd7-b640-1f177d1d3caa",
"hotelId": "1714808",
"searchId": "08230dfcc5f0fb95caaa82ce559ea60c4a975d6f",
"rooms": [
{
"amenities": ["Non-Smoking Facility"],
"amenitiesList": [
{
"title": "Non-Smoking Facility",
"id": "123",
"categoryId": "room_features",
"category": "Room Features"
}
],
"bedTypes": [],
"bedrooms": [
{
"bedConfigurations": [
{
"cfgID": 1,
"count": 1,
"sleepCount": 2,
"type": "Full Bed",
"typeID": "full bed"
}
]
}
],
"occupancy": {
"maxAdults": 2,
"maxChildren": 1,
"maxOccupancy": 2,
"requiresExtraBed": false
},
"description": "20 sqm room Continental breakfast included Free WiFi LCD TV Spacious work desk Choice of pillows Coffee and tea facilities Large walk-in power shower",
"id": "K0LnAe-G9WI",
"images": [{ "url": "http://images.getaroom-cdn.com/image/...." }],
"masterId": "9643931",
"name": "1 Double Standard",
"offers": [
{
"availableRooms": 0,
"canPayLater": false,
"cancellationPenalties": [],
"cug": ["signed_in"],
"id": "o0KDe_mFPN4k",
"links": [
{
"href": "https://secure.findhotel.net/checkout/?hotelID=1714808...",
"method": "GET",
"type": "checkout"
}
],
"prices": [
{
"chargeable": { "base": "1352.77", "taxes": "59.94" },
"currencyCode": "EUR",
"hotelFees": { "breakdown": [], "total": "0" },
"type": "chargeable_currency"
}
],
"mealPlan": [
{
"meal": "breakfast",
"rule": {
"adults": 2,
"kids": 1
}
}
],
"providerCode": "GAR",
"providerRateType": "public",
"services": ["breakfast"]
}
]
}
]
}
V2 回应
{
"entities": [
{
"id": "b57ac4d3-72bf-4f0c-b82f-28e29543c06a",
"entityType": "split_booking",
"rooms": [
{
"id": "SHPLitp7oTk",
"name": "Room",
"raaName": "Room",
"amenities": [],
"amenitiesList": [],
"images": [],
"description": "",
"smokingOptionsAvailable": false,
"bedTypes": [],
"area": {},
"bedrooms": [
{
"bedConfigurations": [
{
"cfgID": 1,
"count": 1,
"sleepCount": 2,
"type": "Full Bed",
"typeID": "full bed"
}
]
}
],
"occupancy": {
"maxAdults": 2,
"maxChildren": 1,
"maxOccupancy": 2,
"requiresExtraBed": false
}
},
{
"id": "dn4Qijq4auI",
"name": "cosy room(City view)",
"raaName": "cosy room(City view)",
"amenities": [],
"amenitiesList": [],
"images": [],
"description": "",
"smokingOptionsAvailable": false,
"bedTypes": [],
"area": {},
"bedrooms": [
{
"bedConfigurations": [
{
"cfgID": 1,
"count": 1,
"sleepCount": 2,
"type": "Full Bed",
"typeID": "full bed"
}
]
}
],
"occupancy": {
"maxAdults": 2,
"maxChildren": 1,
"maxOccupancy": 2,
"requiresExtraBed": false
}
}
],
"offers": [
{
"isClicked": true,
"matchType": "by_price",
"matchedOfferPriceDiff": 0,
"id": "b57ac4d3-72bf-4f0c-b82f-28e29543c06a",
"availableRooms": null,
"canPayLater": false,
"cancellationPenalties": [],
"cug": null,
"links": [
{
"href": "https://secure.findhotel.net/checkout/?bundleId=b57ac4d3-72bf-4f0c-b82f-28e29543c06a..",
"method": "GET",
"type": "checkout"
}
],
"prices": [
{
"chargeable": {
"base": "570.7278477192",
"taxes": "46.6959148134"
},
"currencyCode": "EUR",
"hotelFees": {
"breakdown": [],
"total": "74.1946202035"
},
"rate": {
"base": 570.7278477192,
"taxes": 46.6959148134,
"hotelFees": 74.1946202035
},
"type": "chargeable_currency"
}
],
"services": null,
"providerCode": "",
"tags": ["price_matched", "sb_single_flow"],
"metadata": {
"feedID": ""
},
"offerType": "split_booking",
"itineraries": [
{
"checkIn": "2025-03-30",
"checkOut": "2025-03-31",
"roomID": "SHPLitp7oTk",
"offer": {
"id": "ojnRYasJ3-Ws",
"availableRooms": null,
"providerRateType": "public",
"canPayLater": false,
"cancellationPenalties": [],
"cug": [],
"links": [
{
"href": "https://secure.findhotel.net/checkout/?hotelId=1041597...",
"method": "GET",
"type": "checkout"
}
],
"prices": [
{
"chargeable": {
"base": "119.8596330275",
"taxes": "9.8066972477"
},
"currencyCode": "EUR",
"hotelFees": {
"breakdown": [],
"total": "15.5817522936"
},
"rate": {
"base": 119.8596330275,
"taxes": 9.8066972477,
"hotelFees": 15.5817522936
},
"type": "chargeable_currency"
}
],
"mealPlan": [
{
"meal": "breakfast"
}
],
"services": [],
"providerCode": "SMR",
"tags": [
"preferred_rate",
"top_offer",
"exclusive_cheapest_offer"
],
"metadata": {
"providerRateType": "public",
"feedID": ""
},
"offerType": "regular",
"itineraries": null,
"totalRate": {
"base": 0,
"taxes": 0,
"hotelFees": 0
}
}
},
{
"checkIn": "2025-03-31",
"checkOut": "2025-04-03",
"roomID": "dn4Qijq4auI",
"offer": {
"id": "o33J8HXa4tJY",
"availableRooms": 99,
"providerRateType": "plus",
"canPayLater": false,
"cancellationPenalties": [],
"cug": [],
"links": [
{
"href": "https://secure.findhotel.net/checkout/?hotelId=1041597...",
"method": "GET",
"type": "checkout"
}
],
"prices": [
{
"chargeable": {
"base": "450.8682146917",
"taxes": "36.8892175657"
},
"currencyCode": "EUR",
"hotelFees": {
"breakdown": [],
"total": "58.6128679099"
},
"rate": {
"base": 450.8682146917,
"taxes": 36.8892175657,
"hotelFees": 58.6128679099
},
"type": "chargeable_currency"
}
],
"mealPlan": [
{
"meal": "breakfast",
"rule": {
"guests": 2
}
}
],
"services": [],
"providerCode": "DDT",
"tags": [
"preferred_rate",
"top_offer",
"exclusive_cheapest_offer"
],
"metadata": {
"providerRateType": "plus",
"feedID": ""
},
"offerType": "regular",
"itineraries": null,
"totalRate": {
"base": 0,
"taxes": 0,
"hotelFees": 0
}
}
}
],
"totalRate": {
"base": 570.7278477192,
"taxes": 46.6959148134,
"hotelFees": 74.1946202035
}
}
],
"hasClickedOffer": true
},
{
"id": "dn4Qijq4auI",
"entityType": "room",
"rooms": [
{
"id": "dn4Qijq4auI",
"name": "cosy room(City view)",
"raaName": "cosy room(City view)",
"amenities": [],
"amenitiesList": [],
"images": [],
"description": "",
"smokingOptionsAvailable": false,
"bedTypes": [],
"area": {}
}
],
"offers": [
{
"id": "o-9NZdSFm3Qc",
"availableRooms": 99,
"providerRateType": "plus",
"canPayLater": false,
"cancellationPenalties": [],
"cug": [],
"links": [
{
"href": "https://secure.findhotel.net/checkout/?hotelId=1041597...",
"method": "GET",
"type": "checkout"
}
],
"prices": [
{
"chargeable": {
"base": "575.6297833706",
"taxes": "47.0969822758"
},
"currencyCode": "EUR",
"hotelFees": {
"breakdown": [],
"total": "74.8318718382"
},
"rate": {
"base": 575.6297833706,
"taxes": 47.0969822758,
"hotelFees": 74.8318718382
},
"type": "chargeable_currency"
}
],
"mealPlan": [
{
"meal": "allInclusive"
}
],
"services": [],
"providerCode": "DDT",
"tags": ["top_offer", "exclusive_cheapest_offer"],
"metadata": {
"providerRateType": "plus",
"feedID": ""
},
"offerType": "regular",
"itineraries": null,
"totalRate": {
"base": 0,
"taxes": 0,
"hotelFees": 0
}
}
],
"hasClickedOffer": false
}
]
}
投票时间长 rooms() 方法
这个 rooms() 方法既支持同步请求,也支持长波.
为了实现长波波,仅提供回调作为第二个论据 rooms() 方法 :
const parameters = {
hotelId: "1714808",
checkIn: "2021-10-10",
checkOut: "2021-10-11",
rooms: "2",
};
const callbacks = {
onStart(response) {
log("Rooms Offers Poll Started", response);
},
onOffersReceived(response) {
log("Rooms Offers Poll Received", response);
},
onComplete(response) {
log("Rooms Offers Poll Completed", response);
},
};
const rooms = await sapiClient.rooms(parameters, callbacks);
答复采用与标准室提供请求相同的结构,并增加了一个状态参数,表明长波的进度
{
"anonymousId": "fd9dbb5f-b337-4dd7-b640-1f177d1d3caa",
"hotelId": "1041597",
"searchId": "9248cf1d-1fdd-4aa5-af6d-2ec6e6671009",
"rooms": [...],
"splitBooking": {...},
"status": {
"complete": true
}
}
房间服务也可包括可选的 mealPlan 包含详细餐饮分类条目的阵列,而提供和酒店供应的回复则在下文披露同样细节 package.mealPlan。见 提供答复 合同细节.
hotel() 方法
旅馆是一种方法 sapi 客户端 由 id 取回一家旅馆
const hotel = await sapiClient.hotel("1196472");
旅馆参数
| 名称 | 类型 | 说明 | 所需经费 | 实例 |
|---|---|---|---|---|
hotelId | string | 旅馆 | 对 | 1196472 |
回应
请求回复实例 hotelId 1196472 (英语)
还有"pt-BR" language
{
"objectID": "1196472",
"guestRating": {
"cleanliness": 8.82,
"dining": 8.73,
"facilities": 8.73,
"location": 8.8,
"overall": 8.54,
"pricing": 4.49,
"rooms": 8.82,
"service": 8.67
},
"isDeleted": false,
"starRating": 4,
"_geoloc": {
"lat": 52.377805,
"lon": 4.914172
},
"feesOpt": "<p>Os seguintes depósitos e taxas são cobrados pelo hotel no momento do serviço prestado, durante o check-in ou check-out. </p> <ul> <li>Taxa para café da manhã em estilo buffet: EUR 25.00 por pessoa (aproximadamente)</li> <li>Taxa para o acesso à internet com fio no quarto: EUR 15 por dia (as tarifas podem variar)</li> </ul> <p>A lista acima pode estar incompleta. As taxas e os depósitos podem não incluir impostos e estão sujeitos a mudanças. </p>",
"checkInSpInst": "O funcionário da recepção receberá os hóspedes na chegada. Para mais informações, entre em contato com o estabelecimento usando os dados que estão na confirmação da reserva. Os hóspedes que forem usar o traslado da Estação Central de Amsterdã devem entrar em contato com o estabelecimento com antecedência. Devido à COVID-19, as opções de comida e bebida deste estabelecimento podem estar limitadas de acordo com os regulamentos locais.",
"policies": "<ul> <li>Este estabelecimento oferece transporte da estação de trem. Os hóspedes devem entrar em contato com o estabelecimento antes da viagem com os detalhes da chegada usando as informações para contato presentes na confirmação da reserva. </li> <li>É necessário reservar os seguintes serviços: serviços de massagem. As reservas podem ser feitas contatando este hotel antes da viagem usando as informações para contato fornecidas na confirmação da reserva. </li> <li>Somente hóspedes registrados podem ter acesso aos quartos. </li></ul>",
"phone": "+31205191200",
"imageURIs": [
"https://i.travelapi.com/hotels/2000000/1460000/1452100/1452083/a39e2fc8_w.jpg",
"https://i.travelapi.com/hotels/2000000/1460000/1452100/1452083/3892e861_w.jpg",
"https://i.travelapi.com/hotels/2000000/1460000/1452100/1452083/aed25438_w.jpg"
],
"checkInTime": "15:00",
"checkInInst": "<ul> <li>Pessoas extras podem incorrer em taxas adicionais que variam dependendo da política do estabelecimento</li><li>Documento de identificação oficial com foto e cartão de crédito, cartão de débito ou depósito em dinheiro podem ser exigidos no momento do check-in para despesas extras.</li></ul>",
"reviewCount": 17538,
"chainID": "2101",
"checkInEnd": "01:00",
"lastBooked": 1608030831,
"checkOutTime": "12:00",
"feesMnd": "<p>Você deverá pagar os seguintes encargos no estabelecimento:</p> <ul><li>Depósito: EUR 50 por noite</li><li>A cidade cobra um imposto de EUR 3.00 por pessoa, por noite até 21 noites. Esse imposto não se aplica a crianças de até 16 anos. </li><li>Será cobrado um imposto municipal/local de 6.422 %</li></ul> <p>Incluímos todas as cobranças que o estabelecimento nos forneceu. No entanto, as cobranças podem variar com base, por exemplo, na duração da estadia ou no tipo de quarto reservado. </p>",
"deposit": {
"value": {
"currency": "USD",
"amount": 300.0
},
"description": "Deposit: USD 300.00 per accommodation<br>Breakage deposit: USD 230.00"
},
"reviewCountBkt": 9,
"hotelName": "Movenpick Hotel Amsterdam City Centre",
"sentiments": [
{
"value": "Gostou do bar",
"id": 46
},
{
"value": "Processo rápido de check-in/check-out",
"id": 180
}
],
"facilities": [
{
"categoryID": 4,
"importance": 2,
"value": "Centro de Negócios",
"id": 1
},
{
"categoryID": 17,
"importance": 2,
"value": "Serviço de quarto",
"id": 2
}
],
"placeID": "311007",
"guestType": {
"business": 1333,
"couples": 3125,
"families":