@findhotel/sapi 0.25.3 → 0.25.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +742 -1316
- package/dist/index.js +1 -1
- package/dist/types/packages/core/src/types/rooms.d.ts +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,1522 +1,948 @@
|
|
|
1
|
-
|
|
2
|
-
# Table of Contents
|
|
3
|
-
|
|
4
|
-
1. [Release process](#release-process)
|
|
5
|
-
1. [GitHub Token](#github-token)
|
|
6
|
-
2. [New release](#new-release)
|
|
7
|
-
2. [Tutorials](#tutorials)
|
|
8
|
-
1. [Getting Started](#getting-started)
|
|
9
|
-
2. [React Native](#react-native)
|
|
10
|
-
3. [Usage](#usage)
|
|
11
|
-
1. [Search](#tutorial-hotels-search)
|
|
12
|
-
2. [Get hotel's rooms offers](#tutorial-get-rooms)
|
|
13
|
-
3. [Get hotel](#tutorial-get-hotel)
|
|
14
|
-
4. [Get hotel offers](#tutorial-get-offers)
|
|
15
|
-
3. [API Reference](#api-reference)
|
|
16
|
-
1. [SAPI client](#sapi-client)
|
|
17
|
-
1. [Supported options](#client-options)
|
|
18
|
-
2. [Available client callbacks](#client-callbacks)
|
|
19
|
-
2. [Response](#config-response)
|
|
20
|
-
3. [`search()` method](#search-method)
|
|
21
|
-
1. [Search parameters](#search-parameters)
|
|
22
|
-
2. [Callbacks](#search-callbacks)
|
|
23
|
-
3. [Response](#search-response)
|
|
24
|
-
4. [`suggest()` method](#suggest-method)
|
|
25
|
-
1. [Suggest parameters](#suggest-parameters)
|
|
26
|
-
2. [Response](#suggest-response)
|
|
27
|
-
5. [`rooms()` method](#rooms-method)
|
|
28
|
-
1. [Rooms parameters](#rooms-parameters)
|
|
29
|
-
2. [Response](#rooms-response)
|
|
30
|
-
6. [`hotel()` method](#hotel-method)
|
|
31
|
-
1. [Hotel parameters](#hotel-parameters)
|
|
32
|
-
2. [Response](#hotel-response)
|
|
33
|
-
7. [`offers()` method](#offers-method)
|
|
34
|
-
1. [Offers parameters](#hotel-parameters)
|
|
35
|
-
2. [Callbacks](#offers-callbacks)
|
|
36
|
-
3. [Response](#offers-response)
|
|
1
|
+
# SAPI SDK
|
|
37
2
|
|
|
38
3
|
SDK provides a high level TypeScript/JavaScript API for searching
|
|
39
|
-
hotels, hotels' offers and rooms.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
4
|
+
hotels, hotels\' offers and rooms.
|
|
5
|
+
|
|
6
|
+
# Table of contents
|
|
7
|
+
|
|
8
|
+
- [SAPI SDK](#sapi-sdk)
|
|
9
|
+
- [Table of contents](#table-of-contents)
|
|
10
|
+
- [Release process](#release-process)
|
|
11
|
+
- [GitHub Token](#github-token)
|
|
12
|
+
- [New release](#new-release)
|
|
13
|
+
- [Tutorials](#tutorials)
|
|
14
|
+
- [Getting Started](#getting-started)
|
|
15
|
+
- [React Native](#react-native)
|
|
16
|
+
- [Usage](#usage)
|
|
17
|
+
- [Search](#search)
|
|
18
|
+
- [Get hotel\'s rooms offers](#get-hotels-rooms-offers)
|
|
19
|
+
- [Get hotel](#get-hotel)
|
|
20
|
+
- [Get hotel offers](#get-hotel-offers)
|
|
21
|
+
- [API Reference](#api-reference)
|
|
22
|
+
- [SAPI client](#sapi-client)
|
|
23
|
+
- [Supported options](#supported-options)
|
|
24
|
+
- [Available client callbacks](#available-client-callbacks)
|
|
25
|
+
- [Response](#response)
|
|
26
|
+
- [`search()` method](#search-method)
|
|
27
|
+
- [Search parameters](#search-parameters)
|
|
28
|
+
- [Callbacks](#callbacks)
|
|
29
|
+
- [Response](#response-1)
|
|
30
|
+
- [`suggest()` method](#suggest-method)
|
|
31
|
+
- [Suggest parameters](#suggest-parameters)
|
|
32
|
+
- [Response](#response-2)
|
|
33
|
+
- [`rooms()` method](#rooms-method)
|
|
34
|
+
- [Rooms parameters](#rooms-parameters)
|
|
35
|
+
- [Response](#response-3)
|
|
36
|
+
- [`hotel()` method](#hotel-method)
|
|
37
|
+
- [Hotel parameters](#hotel-parameters)
|
|
38
|
+
- [Response](#response-4)
|
|
39
|
+
- [`offers()` method](#offers-method)
|
|
40
|
+
- [Offers parameters](#offers-parameters)
|
|
41
|
+
- [Callbacks](#callbacks-1)
|
|
42
|
+
- [Response](#response-5)
|
|
43
43
|
|
|
44
44
|
# Release process
|
|
45
45
|
|
|
46
|
-
There is no continuous integration/delivery in SAP SDK. Merging a PR
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
There is no continuous integration/delivery in SAP SDK. Merging a PR
|
|
47
|
+
into main branch doesn\'t automatically trigger the release process. For
|
|
48
|
+
releases SAPI SDK uses [Ship.js](https://github.com/algolia/shipjs)
|
|
49
|
+
tool. It gives more control over the process. Ship.js automatically
|
|
50
|
+
creates a PR before publishing every release, so this allows:
|
|
49
51
|
|
|
50
52
|
- Confirm the next version is correct.
|
|
51
|
-
- Confirm which commits are going to be released and discuss them with
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
<a id="github-token"></a>
|
|
53
|
+
- Confirm which commits are going to be released and discuss them with
|
|
54
|
+
colleagues.
|
|
55
|
+
- Edit the automatically generated changelog for clarity &
|
|
56
|
+
readability.
|
|
56
57
|
|
|
57
58
|
## GitHub Token
|
|
58
59
|
|
|
59
60
|
GitHub token is required for the release process:
|
|
60
61
|
|
|
61
62
|
- Go to [your github account](https://github.com/settings/tokens/new)
|
|
62
|
-
- Check "repo(Full control of private repositories)"
|
|
63
|
+
- Check \"repo(Full control of private repositories)\"
|
|
63
64
|
- Generate/copy the token
|
|
64
65
|
- Add it in your command line like: `GITHUB_TOKEN=xxx`
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
<a id="new-release"></a>
|
|
68
|
-
|
|
69
67
|
## New release
|
|
70
68
|
|
|
71
|
-
To create and deploy a new release of SAPI SDK please follow the next
|
|
69
|
+
To create and deploy a new release of SAPI SDK please follow the next
|
|
70
|
+
steps:
|
|
72
71
|
|
|
73
72
|
- Merge your changes. There can be multiple changes in one release
|
|
74
73
|
- Checkout the lates version of the `main` branch
|
|
75
|
-
- In the root directory run `make release` command - this
|
|
74
|
+
- In the root directory run `make release` command - this
|
|
75
|
+
will start the relase process
|
|
76
76
|
- Review and confirm (or change) the new release version number
|
|
77
|
-
- After installing dependenices and running deployment scripts a new
|
|
78
|
-
|
|
77
|
+
- After installing dependenices and running deployment scripts a new
|
|
78
|
+
pull request will be automatically created
|
|
79
|
+
- Review/update `CHANGELOG.md` in the root directory. Write down
|
|
80
|
+
changes with descriptions using [keep a changelog] guiding
|
|
81
|
+
principles and commit your changes to the newelly created release
|
|
82
|
+
PR
|
|
79
83
|
- Review the PR/ask SAPI engineer(s) for approval
|
|
80
|
-
- `Squash and merge` the PR. This will trigger automated
|
|
84
|
+
- `Squash and merge` the PR. This will trigger automated
|
|
85
|
+
release procees using github actions and after some time the new
|
|
86
|
+
release will be published to NMP
|
|
81
87
|
- Check if the new version has been published to NPM
|
|
82
88
|
|
|
83
|
-
|
|
84
|
-
<a id="tutorials"></a>
|
|
89
|
+
[keep a changelog]: https://keepachangelog.com/
|
|
85
90
|
|
|
86
91
|
# Tutorials
|
|
87
92
|
|
|
88
|
-
|
|
89
|
-
<a id="getting-started"></a>
|
|
90
|
-
|
|
91
93
|
## Getting Started
|
|
92
94
|
|
|
93
|
-
First, install SAPI SDK via the [npm](https://www.npmjs.com/get-npm)
|
|
95
|
+
First, install SAPI SDK via the [npm](https://www.npmjs.com/get-npm)
|
|
96
|
+
package manager:
|
|
94
97
|
|
|
95
|
-
|
|
98
|
+
```sh
|
|
99
|
+
npm install @findhotel/sapi
|
|
100
|
+
```
|
|
96
101
|
|
|
97
102
|
Then, import SAPI into your project:
|
|
98
103
|
|
|
99
|
-
|
|
104
|
+
```js
|
|
105
|
+
import sapi from '@findhotel/sapi'
|
|
106
|
+
```
|
|
100
107
|
|
|
101
108
|
Create SAPI client:
|
|
102
109
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
```js
|
|
111
|
+
const profileKey = 'profile-key'
|
|
112
|
+
|
|
113
|
+
const sapiClient = await sapi(profileKey, {
|
|
114
|
+
anonymousId: 'fd9dbb5f-b337-4dd7-b640-1f177d1d3caa',
|
|
115
|
+
language: 'en',
|
|
116
|
+
currency: 'USD',
|
|
117
|
+
countryCode: 'US'
|
|
118
|
+
})
|
|
119
|
+
```
|
|
111
120
|
|
|
112
121
|
Now SAPI client is ready to be used in your application.
|
|
113
122
|
|
|
114
123
|
For full documentation and supported options check [client api](#sapi-client).
|
|
115
124
|
|
|
116
|
-
|
|
117
|
-
<a id="react-native"></a>
|
|
118
|
-
|
|
119
125
|
## React Native
|
|
120
126
|
|
|
121
|
-
Sapi SDK uses `uuid` for generation of random strings.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
To add support, `crypto` polyfill should be installed on the consumer side.
|
|
125
|
-
We recommend installing just `crypto.getRandomValues` polyfill if you don’t use other `crypto` methods.
|
|
126
|
-
More information about polyfill can be found [here](https://www.npmjs.com/package/react-native-get-random-values)
|
|
127
|
-
|
|
127
|
+
Sapi SDK uses `uuid` for generation of random strings.
|
|
128
|
+
`uuid` uses a global `crypto` object which is not
|
|
129
|
+
available in React Native environment.
|
|
128
130
|
|
|
129
|
-
|
|
131
|
+
To add support, `crypto` polyfill should be installed on the
|
|
132
|
+
consumer side. We recommend installing just
|
|
133
|
+
`crypto.getRandomValues` polyfill if you don't use other
|
|
134
|
+
`crypto` methods. More information about polyfill can be
|
|
135
|
+
found [here](https://www.npmjs.com/package/react-native-get-random-values)
|
|
130
136
|
|
|
131
137
|
## Usage
|
|
132
138
|
|
|
133
|
-
|
|
134
|
-
<a id="tutorial-hotels-search"></a>
|
|
135
|
-
|
|
136
139
|
### Search
|
|
140
|
+
<a id="tutorial-hotels-search"></a>
|
|
137
141
|
|
|
138
|
-
Search for the hotels and hotels' offers:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
142
|
+
Search for the hotels and hotels\' offers:
|
|
143
|
+
|
|
144
|
+
```js
|
|
145
|
+
const searchParameters = {
|
|
146
|
+
placeId: '47319',
|
|
147
|
+
checkIn: '2021-10-10',
|
|
148
|
+
checkOut: '2021-10-11',
|
|
149
|
+
rooms: '2'
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const callbacks = {
|
|
153
|
+
onStart: (response) => {
|
|
154
|
+
log('Search started', response)
|
|
155
|
+
},
|
|
156
|
+
onAnchorReceived: (response) => {
|
|
157
|
+
log('Anchor received', response)
|
|
158
|
+
},
|
|
159
|
+
onHotelsReceived: (response) => {
|
|
160
|
+
log('Hotels received', response)
|
|
161
|
+
},
|
|
162
|
+
onOffersReceived: (response) => {
|
|
163
|
+
log('Offers received', response)
|
|
164
|
+
},
|
|
165
|
+
onComplete: (response) => {
|
|
166
|
+
log('Search completed', response)
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const search = await sapiClient.search(searchParameters, callbacks)
|
|
171
|
+
```
|
|
166
172
|
|
|
167
173
|
For full documentation, check [search method api](#search-method).
|
|
168
174
|
|
|
169
|
-
|
|
175
|
+
### Get hotel\'s rooms offers
|
|
170
176
|
<a id="tutorial-get-rooms"></a>
|
|
171
177
|
|
|
172
|
-
|
|
178
|
+
Get rooms data and rooms\' offers:
|
|
173
179
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
```js
|
|
181
|
+
const rooms = await sapiClient.rooms({
|
|
182
|
+
hotelId: '47319',
|
|
183
|
+
checkIn: '2021-10-10',
|
|
184
|
+
checkOut: '2021-10-11',
|
|
185
|
+
rooms: '2'
|
|
186
|
+
})
|
|
187
|
+
```
|
|
182
188
|
|
|
183
189
|
For full documentation, check [rooms method api](#rooms-method).
|
|
184
190
|
|
|
185
|
-
|
|
186
|
-
<a id="tutorial-get-hotel"></a>
|
|
187
|
-
|
|
188
191
|
### Get hotel
|
|
192
|
+
<a id="tutorial-get-hotel"></a>
|
|
189
193
|
|
|
190
194
|
Get hotel by id:
|
|
191
195
|
|
|
192
|
-
|
|
196
|
+
```js
|
|
197
|
+
const hotel = await sapiClient.hotel('1196472')
|
|
198
|
+
```
|
|
193
199
|
|
|
194
200
|
For full documentation, check [hotel method api](#hotel-method).
|
|
195
201
|
|
|
196
|
-
|
|
197
|
-
<a id="tutorial-get-offers"></a>
|
|
198
|
-
|
|
199
202
|
### Get hotel offers
|
|
203
|
+
<a id="tutorial-get-offers"></a>
|
|
200
204
|
|
|
201
205
|
Get offers for a single hotel:
|
|
202
206
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
207
|
+
```js
|
|
208
|
+
const parameters = {
|
|
209
|
+
hotelId: '1196472'
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const callbacks = {
|
|
213
|
+
onStart: (response) => {
|
|
214
|
+
log('Offers started', response)
|
|
215
|
+
},
|
|
216
|
+
onOffersReceived: (response) => {
|
|
217
|
+
log('Offers received', response)
|
|
218
|
+
},
|
|
219
|
+
onComplete: (response) => {
|
|
220
|
+
log('Offers completed', response)
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const offers = await sapiClient.offers(parameters, callbacks)
|
|
225
|
+
```
|
|
220
226
|
|
|
221
227
|
For full documentation, check [offers method api](#offers-method).
|
|
222
228
|
|
|
223
|
-
|
|
224
|
-
<a id="api-reference"></a>
|
|
225
|
-
|
|
226
229
|
# API Reference
|
|
227
230
|
|
|
228
|
-
|
|
229
|
-
<a id="sapi-client"></a>
|
|
230
|
-
|
|
231
231
|
## SAPI client
|
|
232
|
+
<a id="sapi-client"></a>
|
|
232
233
|
|
|
233
234
|
Create SAPI client:
|
|
234
235
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
<a id="client-options"></a>
|
|
236
|
+
```js
|
|
237
|
+
const profileKey = 'profile-key'
|
|
238
|
+
|
|
239
|
+
const sapiClient = await sapi(profileKey, {
|
|
240
|
+
anonymousId: 'fd9dbb5f-b337-4dd7-b640-1f177d1d3caa',
|
|
241
|
+
language: 'en',
|
|
242
|
+
currency: 'USD',
|
|
243
|
+
countryCode: 'US',
|
|
244
|
+
deviceType: 'mobile',
|
|
245
|
+
includeLocalTaxes: true,
|
|
246
|
+
includeTaxes: false,
|
|
247
|
+
pageSize: 20,
|
|
248
|
+
initWithAppConfig: {
|
|
249
|
+
features: ['search', 'configs'],
|
|
250
|
+
},
|
|
251
|
+
algoliaClientOptions: {
|
|
252
|
+
timeouts: {
|
|
253
|
+
connect: 1, // Connection timeout in seconds
|
|
254
|
+
read: 2, // Read timeout in seconds
|
|
255
|
+
write: 30, // Write timeout in seconds
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
callbacks: {
|
|
259
|
+
onConfigReceived: (config) => {
|
|
260
|
+
log('Config received', config)
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
})
|
|
264
|
+
```
|
|
265
265
|
|
|
266
266
|
### Supported options
|
|
267
|
+
<a id="client-options"></a>
|
|
267
268
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
<
|
|
281
|
-
|
|
282
|
-
<col class="org-left" />
|
|
283
|
-
</colgroup>
|
|
284
|
-
<thead>
|
|
285
|
-
<tr>
|
|
286
|
-
<th scope="col" class="org-left">name</th>
|
|
287
|
-
<th scope="col" class="org-left">required</th>
|
|
288
|
-
<th scope="col" class="org-left">type</th>
|
|
289
|
-
<th scope="col" class="org-left">default</th>
|
|
290
|
-
<th scope="col" class="org-left">description</th>
|
|
291
|
-
<th scope="col" class="org-left">example</th>
|
|
292
|
-
</tr>
|
|
293
|
-
</thead>
|
|
294
|
-
|
|
295
|
-
<tbody>
|
|
296
|
-
<tr>
|
|
297
|
-
<td class="org-left">`anonymousId`</td>
|
|
298
|
-
<td class="org-left">yes</td>
|
|
299
|
-
<td class="org-left">`string`</td>
|
|
300
|
-
<td class="org-left"> </td>
|
|
301
|
-
<td class="org-left">Unique ID identifying users</td>
|
|
302
|
-
<td class="org-left">`2d360284-577b-4a53-8b91-68f72b9227fa`</td>
|
|
303
|
-
</tr>
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
<tr>
|
|
307
|
-
<td class="org-left">`language`</td>
|
|
308
|
-
<td class="org-left">no</td>
|
|
309
|
-
<td class="org-left">`string`</td>
|
|
310
|
-
<td class="org-left">`en`</td>
|
|
311
|
-
<td class="org-left">2-char language code</td>
|
|
312
|
-
<td class="org-left">`en`</td>
|
|
313
|
-
</tr>
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
<tr>
|
|
317
|
-
<td class="org-left">`currency`</td>
|
|
318
|
-
<td class="org-left">no</td>
|
|
319
|
-
<td class="org-left">`string`</td>
|
|
320
|
-
<td class="org-left">`USD`</td>
|
|
321
|
-
<td class="org-left">3-char uppercased ISO currency code</td>
|
|
322
|
-
<td class="org-left">`USD`</td>
|
|
323
|
-
</tr>
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
<tr>
|
|
327
|
-
<td class="org-left">`countryCode`</td>
|
|
328
|
-
<td class="org-left">no</td>
|
|
329
|
-
<td class="org-left">`string`</td>
|
|
330
|
-
<td class="org-left">`US`</td>
|
|
331
|
-
<td class="org-left">2-char uppercased ISO country code</td>
|
|
332
|
-
<td class="org-left">`US`</td>
|
|
333
|
-
</tr>
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
<tr>
|
|
337
|
-
<td class="org-left">`deviceType`</td>
|
|
338
|
-
<td class="org-left">yes</td>
|
|
339
|
-
<td class="org-left">`string`</td>
|
|
340
|
-
<td class="org-left"> </td>
|
|
341
|
-
<td class="org-left">`desktop` or `mobile`</td>
|
|
342
|
-
<td class="org-left">`desktop`</td>
|
|
343
|
-
</tr>
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
<tr>
|
|
347
|
-
<td class="org-left">`includeLocalTaxes`</td>
|
|
348
|
-
<td class="org-left">no</td>
|
|
349
|
-
<td class="org-left">`boolean`</td>
|
|
350
|
-
<td class="org-left"> </td>
|
|
351
|
-
<td class="org-left">Include or not local taxes based in the displayed price</td>
|
|
352
|
-
<td class="org-left">`false`</td>
|
|
353
|
-
</tr>
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
<tr>
|
|
357
|
-
<td class="org-left">`includeTaxes`</td>
|
|
358
|
-
<td class="org-left">no</td>
|
|
359
|
-
<td class="org-left">`boolean`</td>
|
|
360
|
-
<td class="org-left"> </td>
|
|
361
|
-
<td class="org-left">Include or not taxes based in the displayed price</td>
|
|
362
|
-
<td class="org-left">`false`</td>
|
|
363
|
-
</tr>
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
<tr>
|
|
367
|
-
<td class="org-left">`pageSize`</td>
|
|
368
|
-
<td class="org-left">no</td>
|
|
369
|
-
<td class="org-left">`number`</td>
|
|
370
|
-
<td class="org-left">`20`</td>
|
|
371
|
-
<td class="org-left">Displayed page size</td>
|
|
372
|
-
<td class="org-left">`20`</td>
|
|
373
|
-
</tr>
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
<tr>
|
|
377
|
-
<td class="org-left">`initWithAppConfig`</td>
|
|
378
|
-
<td class="org-left">no</td>
|
|
379
|
-
<td class="org-left">`AppConfig`</td>
|
|
380
|
-
<td class="org-left"> </td>
|
|
381
|
-
<td class="org-left">External app config to override internal one</td>
|
|
382
|
-
<td class="org-left"> </td>
|
|
383
|
-
</tr>
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
<tr>
|
|
387
|
-
<td class="org-left">`algoliaClientOptions`</td>
|
|
388
|
-
<td class="org-left">no</td>
|
|
389
|
-
<td class="org-left">`AlgoliaSearchOptions`</td>
|
|
390
|
-
<td class="org-left"> </td>
|
|
391
|
-
<td class="org-left">Algolia client options used for debugging and setting additional options like timeouts etc.</td>
|
|
392
|
-
<td class="org-left"> </td>
|
|
393
|
-
</tr>
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
<tr>
|
|
397
|
-
<td class="org-left">`variations`</td>
|
|
398
|
-
<td class="org-left">no</td>
|
|
399
|
-
<td class="org-left">`Record<string, string>`</td>
|
|
400
|
-
<td class="org-left"> </td>
|
|
401
|
-
<td class="org-left">A/B test variations</td>
|
|
402
|
-
<td class="org-left">`{'pp000004-tags2': 'b', 'pp000004-tags3': '1'}`</td>
|
|
403
|
-
</tr>
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
<tr>
|
|
407
|
-
<td class="org-left">`callbacks`</td>
|
|
408
|
-
<td class="org-left">no</td>
|
|
409
|
-
<td class="org-left">`Record<string, fnc>`</td>
|
|
410
|
-
<td class="org-left"> </td>
|
|
411
|
-
<td class="org-left">Client callbasks</td>
|
|
412
|
-
<td class="org-left"> </td>
|
|
413
|
-
</tr>
|
|
414
|
-
</tbody>
|
|
415
|
-
</table>
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
<a id="client-callbacks"></a>
|
|
269
|
+
| name | required | type | default | description | example |
|
|
270
|
+
| ---------------------- | -------- | ------------------------ | ------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------ |
|
|
271
|
+
| `anonymousId` | yes | `string` | | Unique ID identifying users | `2d360284-577b-4a53-8b91-68f72b9227fa` |
|
|
272
|
+
| `language` | no | `string` | `en` | 2-char language code | `en` |
|
|
273
|
+
| `currency` | no | `string` | `USD` | 3-char uppercased ISO currency code | `USD` |
|
|
274
|
+
| `countryCode` | no | `string` | `US` | 2-char uppercased ISO country code | `US` |
|
|
275
|
+
| `deviceType` | yes | `string` | | `desktop` or `mobile` | `desktop` |
|
|
276
|
+
| `includeLocalTaxes` | no | `boolean` | | Include or not local taxes based in the displayed price | `false` |
|
|
277
|
+
| `includeTaxes` | no | `boolean` | | Include or not taxes based in the displayed price | `false` |
|
|
278
|
+
| `pageSize` | no | `number` | `20` | Displayed page size | `20` |
|
|
279
|
+
| `initWithAppConfig` | no | `AppConfig` | | External app config to override internal one | |
|
|
280
|
+
| `algoliaClientOptions` | no | `AlgoliaSearchOptions` | | Algolia client options used for debugging and setting additional options like timeouts etc. | |
|
|
281
|
+
| `variations` | no | `Record<string, string>` | | A/B test variations | `{'pp000004-tags2': 'b', 'pp000004-tags3': '1'}` |
|
|
282
|
+
| `callbacks` | no | `Record<string, fnc>` | | Client callbasks | |
|
|
419
283
|
|
|
420
284
|
### Available client callbacks
|
|
285
|
+
<a id="client-callbacks"></a>
|
|
421
286
|
|
|
422
287
|
1. onConfigReceived(configs)
|
|
423
288
|
|
|
424
289
|
Returns configuration settings that are used by sapiClient.
|
|
425
290
|
|
|
426
|
-
|
|
427
|
-
<a id="config-response"></a>
|
|
428
|
-
|
|
429
291
|
## Response
|
|
292
|
+
<a id="config-response"></a>
|
|
430
293
|
|
|
294
|
+
```js
|
|
295
|
+
{
|
|
296
|
+
"exchangeRates": {
|
|
297
|
+
"EUR": 0.982994
|
|
298
|
+
},
|
|
299
|
+
"lov": [
|
|
431
300
|
{
|
|
432
|
-
"
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
"
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
"id": 7,
|
|
447
|
-
"objectID": "Facility:7",
|
|
448
|
-
"value": {
|
|
449
|
-
"en": "Swimming pool"
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
]
|
|
301
|
+
"id": 9,
|
|
302
|
+
"categoryID": 19,
|
|
303
|
+
"objectID": "Facility:9",
|
|
304
|
+
"value": {
|
|
305
|
+
"en": "Airport shuttle"
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"categoryID": 2,
|
|
310
|
+
"id": 7,
|
|
311
|
+
"objectID": "Facility:7",
|
|
312
|
+
"value": {
|
|
313
|
+
"en": "Swimming pool"
|
|
314
|
+
}
|
|
453
315
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
316
|
+
]
|
|
317
|
+
}
|
|
318
|
+
```
|
|
457
319
|
|
|
458
320
|
## `search()` method
|
|
321
|
+
<a id="search-method"></a>
|
|
459
322
|
|
|
460
323
|
Search is a method of **sapiClient** for searching hotels and offers for
|
|
461
324
|
provided `searchParameters`:
|
|
462
325
|
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
<a id="search-parameters"></a>
|
|
326
|
+
```js
|
|
327
|
+
const search = await sapiClient.search(searchParameters, callbacks)
|
|
328
|
+
```
|
|
467
329
|
|
|
468
330
|
### Search parameters
|
|
331
|
+
<a id="search-parameters"></a>
|
|
469
332
|
|
|
470
333
|
All parameters are optional.
|
|
471
334
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
<tbody>
|
|
494
|
-
<tr>
|
|
495
|
-
<td class="org-left">`hotelId`</td>
|
|
496
|
-
<td class="org-left">`string`</td>
|
|
497
|
-
<td class="org-left">Hotel Id for hotel search. If present, takes precedence over `placeId`, `query` and `geolocation`.</td>
|
|
498
|
-
<td class="org-left">`1371626`</td>
|
|
499
|
-
</tr>
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
<tr>
|
|
503
|
-
<td class="org-left">`placeId`</td>
|
|
504
|
-
<td class="org-left">`string`</td>
|
|
505
|
-
<td class="org-left">Place Id for place search. If present, takes precedence over `query` and `geolocation`.</td>
|
|
506
|
-
<td class="org-left">`47319`</td>
|
|
507
|
-
</tr>
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
<tr>
|
|
511
|
-
<td class="org-left">`geolocation`</td>
|
|
512
|
-
<td class="org-left">`{lat: number, lon: number}`</td>
|
|
513
|
-
<td class="org-left">Geolocation query. If present, takes precedence over `query`</td>
|
|
514
|
-
<td class="org-left">`{lat: 36.114303, lon: -115.178312}`</td>
|
|
515
|
-
</tr>
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
<tr>
|
|
519
|
-
<td class="org-left">`query`</td>
|
|
520
|
-
<td class="org-left">`string`</td>
|
|
521
|
-
<td class="org-left">Free-text query</td>
|
|
522
|
-
<td class="org-left">`Amsterdam city`</td>
|
|
523
|
-
</tr>
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
<tr>
|
|
527
|
-
<td class="org-left">`boundingBox`</td>
|
|
528
|
-
<td class="org-left">`[p1Lat, p1Lng, p2Lat, p2Lng]`</td>
|
|
529
|
-
<td class="org-left">`topLeft` and `bottomRight` coordinates of bounding box to perform search inside it</td>
|
|
530
|
-
<td class="org-left">`[46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625]`</td>
|
|
531
|
-
</tr>
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
<tr>
|
|
535
|
-
<td class="org-left">`checkIn`</td>
|
|
536
|
-
<td class="org-left">`string`</td>
|
|
537
|
-
<td class="org-left">Check in date (`YYYY-MM-DD`)</td>
|
|
538
|
-
<td class="org-left">`2021-10-10`</td>
|
|
539
|
-
</tr>
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
<tr>
|
|
543
|
-
<td class="org-left">`checkOut`</td>
|
|
544
|
-
<td class="org-left">`string`</td>
|
|
545
|
-
<td class="org-left">Check out date (`YYYY-MM-DD`)</td>
|
|
546
|
-
<td class="org-left">`2021-10-11`</td>
|
|
547
|
-
</tr>
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
<tr>
|
|
551
|
-
<td class="org-left">`rooms`</td>
|
|
552
|
-
<td class="org-left">`string`</td>
|
|
553
|
-
<td class="org-left">[Rooms configuration](https://github.com/FindHotel/search-data-pipelines/wiki/Glossary#rooms-configuration)</td>
|
|
554
|
-
<td class="org-left">`2`</td>
|
|
555
|
-
</tr>
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
<tr>
|
|
559
|
-
<td class="org-left">`dayDistance`</td>
|
|
560
|
-
<td class="org-left">`number`</td>
|
|
561
|
-
<td class="org-left">Amount of full days from now to desired check in date (works in combination with `nights` parameter)</td>
|
|
562
|
-
<td class="org-left">`15`</td>
|
|
563
|
-
</tr>
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
<tr>
|
|
567
|
-
<td class="org-left">`nights`</td>
|
|
568
|
-
<td class="org-left">`number`</td>
|
|
569
|
-
<td class="org-left">Number of nights of stay</td>
|
|
570
|
-
<td class="org-left">`3`</td>
|
|
571
|
-
</tr>
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
<tr>
|
|
575
|
-
<td class="org-left">`sortField`</td>
|
|
576
|
-
<td class="org-left">`string`</td>
|
|
577
|
-
<td class="org-left">Defines the sort by criteria</td>
|
|
578
|
-
<td class="org-left">`popularity, price`</td>
|
|
579
|
-
</tr>
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
<tr>
|
|
583
|
-
<td class="org-left">`sortOrder`</td>
|
|
584
|
-
<td class="org-left">`string`</td>
|
|
585
|
-
<td class="org-left">Defines the sort order</td>
|
|
586
|
-
<td class="org-left">`ascending, descending`</td>
|
|
587
|
-
</tr>
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
<tr>
|
|
591
|
-
<td class="org-left">`filters`</td>
|
|
592
|
-
<td class="org-left">`Object`</td>
|
|
593
|
-
<td class="org-left">Object with filters</td>
|
|
594
|
-
<td class="org-left">`{starRatings: 5}`</td>
|
|
595
|
-
</tr>
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
<tr>
|
|
599
|
-
<td class="org-left">`cugDeals`</td>
|
|
600
|
-
<td class="org-left">`string[]`</td>
|
|
601
|
-
<td class="org-left">Codes of closed user group deals to retrieve offers</td>
|
|
602
|
-
<td class="org-left">`['signed_in', 'offline']`</td>
|
|
603
|
-
</tr>
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
<tr>
|
|
607
|
-
<td class="org-left">`tier`</td>
|
|
608
|
-
<td class="org-left">`string`</td>
|
|
609
|
-
<td class="org-left">User tier</td>
|
|
610
|
-
<td class="org-left">`member`</td>
|
|
611
|
-
</tr>
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
<tr>
|
|
615
|
-
<td class="org-left">`originId`</td>
|
|
616
|
-
<td class="org-left">`string`</td>
|
|
617
|
-
<td class="org-left">Identifier of origin where the request was originated</td>
|
|
618
|
-
<td class="org-left">`c3po6twr70`</td>
|
|
619
|
-
</tr>
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
<tr>
|
|
623
|
-
<td class="org-left">`preferredRate`</td>
|
|
624
|
-
<td class="org-left">`number`</td>
|
|
625
|
-
<td class="org-left">Offer's price user saw on a CA (meta) platform</td>
|
|
626
|
-
<td class="org-left">`196`</td>
|
|
627
|
-
</tr>
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
<tr>
|
|
631
|
-
<td class="org-left">`trafficSource`</td>
|
|
632
|
-
<td class="org-left">`string`</td>
|
|
633
|
-
<td class="org-left">Visitor's traffic source. Opaque value that will be passed to tracking systems</td>
|
|
634
|
-
<td class="org-left">`gha-vr`</td>
|
|
635
|
-
</tr>
|
|
636
|
-
</tbody>
|
|
637
|
-
</table>
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
<a id="search-callbacks"></a>
|
|
335
|
+
| name | type | description | example |
|
|
336
|
+
| --------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
|
|
337
|
+
| `hotelId` | `string` | Hotel Id for hotel search. If present, takes precedence over `placeId`, `query` and `geolocation`. | `1371626` |
|
|
338
|
+
| `placeId` | `string` | Place Id for place search. If present, takes precedence over `query` and `geolocation`. | `47319` |
|
|
339
|
+
| `geolocation` | `{lat: number, lon: number}` | Geolocation query. If present, takes precedence over `query` | `{lat: 36.114303, lon: -115.178312}` |
|
|
340
|
+
| `query` | `string` | Free-text query | `Amsterdam city` |
|
|
341
|
+
| `boundingBox` | `[p1Lat, p1Lng, p2Lat, p2Lng]` | `topLeft` and `bottomRight` coordinates of bounding box to perform search inside it | `[46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625]` |
|
|
342
|
+
| `checkIn` | `string` | Check in date (`YYYY-MM-DD`) | `2021-10-10` |
|
|
343
|
+
| `checkOut` | `string` | Check out date (`YYYY-MM-DD`) | `2021-10-11` |
|
|
344
|
+
| `rooms` | `string` | [Rooms configuration](https://github.com/FindHotel/search-data-pipelines/wiki/Glossary#rooms-configuration) | `2` |
|
|
345
|
+
| `dayDistance` | `number` | Amount of full days from now to desired check in date (works in combination with `nights` parameter) | `15` |
|
|
346
|
+
| `nights` | `number` | Number of nights of stay | `3` |
|
|
347
|
+
| `sortField` | `string` | Defines the sort by criteria | `popularity, price` |
|
|
348
|
+
| `sortOrder` | `string` | Defines the sort order | `ascending, descending` |
|
|
349
|
+
| `filters` | `Object` | Object with filters | `{starRatings: 5}` |
|
|
350
|
+
| `cugDeals` | `string[]` | Codes of closed user group deals to retrieve offers | `['signed_in', 'offline']` |
|
|
351
|
+
| `tier` | `string` | User tier | `member` |
|
|
352
|
+
| `originId` | `string` | Identifier of origin where the request was originated | `c3po6twr70` |
|
|
353
|
+
| `preferredRate` | `number` | Offer\'s price user saw on a CA (meta) platform | `196` |
|
|
354
|
+
| `trafficSource` | `string` | Visitor\'s traffic source. Opaque value that will be passed to tracking systems | `gha-vr` |
|
|
641
355
|
|
|
642
356
|
### Callbacks
|
|
357
|
+
<a id="search-callbacks"></a>
|
|
643
358
|
|
|
644
359
|
Search method receives callbacks object as the second argument:
|
|
645
360
|
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
361
|
+
```js
|
|
362
|
+
const callbacks = {
|
|
363
|
+
onStart: (response) => {
|
|
364
|
+
log('Search started', response)
|
|
365
|
+
},
|
|
366
|
+
onAnchorReceived: (response) => {
|
|
367
|
+
log('Anchor received', response)
|
|
368
|
+
},
|
|
369
|
+
onHotelsReceived: (response) => {
|
|
370
|
+
log('Hotels received', response)
|
|
371
|
+
},
|
|
372
|
+
onOffersReceived: (response) => {
|
|
373
|
+
log('Offers received', response)
|
|
374
|
+
},
|
|
375
|
+
onComplete: (response) => {
|
|
376
|
+
log('Search completed', response)
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
Each callback returns the full search state available inside SAPI at the
|
|
382
|
+
time of callbacks executions. This means that each subsequent callback
|
|
383
|
+
incrementally adds new properties and returns updated state. The data in
|
|
384
|
+
the state can be repeated between different callbacks.
|
|
667
385
|
|
|
668
386
|
1. onStart()
|
|
669
387
|
|
|
670
388
|
Runs at the beginning of the each new search.
|
|
671
|
-
|
|
672
|
-
The callback is supplied with generated `searchId` and
|
|
673
|
-
parameters that are used for the search, like dates,
|
|
674
|
-
language used if invoker didn't provide those.
|
|
675
|
-
|
|
676
|
-
Another purpose of this callback is that invoker can track that
|
|
677
|
-
search has started, in Search SPA the event is
|
|
389
|
+
|
|
390
|
+
The callback is supplied with generated `searchId` and
|
|
391
|
+
actual search parameters that are used for the search, like dates,
|
|
392
|
+
currency, language used if invoker didn\'t provide those.
|
|
393
|
+
|
|
394
|
+
Another purpose of this callback is that invoker can track that
|
|
395
|
+
hotels search has started, in Search SPA the event is
|
|
396
|
+
[HotelsSearched](https://engdocs.fih.io/event-analytics/sources/#event-hotelssearched).
|
|
678
397
|
|
|
679
398
|
2. onAnchorReceived()
|
|
680
399
|
|
|
681
|
-
Runs when SAPI receives anchor and(?) anchor hotel (in case of hotel
|
|
682
|
-
|
|
683
|
-
Returns static data about anchor `response.anchor`
|
|
684
|
-
|
|
400
|
+
Runs when SAPI receives anchor and(?) anchor hotel (in case of hotel
|
|
401
|
+
search)\
|
|
402
|
+
Returns static data about anchor `response.anchor` and(?)
|
|
403
|
+
anchor hotel inside `response.hotelEntities` object (in
|
|
404
|
+
case of hotel search).
|
|
685
405
|
|
|
686
406
|
3. onHotelsReceived()
|
|
687
407
|
|
|
688
|
-
Runs when SAPI receives static search results
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
408
|
+
Runs when SAPI receives static search results\
|
|
409
|
+
Returns static data about hotels inside
|
|
410
|
+
`response.hotelEntities` object as well as appropriate
|
|
411
|
+
hotel sort order in `response.hotelIds` array (sorted
|
|
412
|
+
according HSO).
|
|
692
413
|
|
|
693
414
|
4. onOffersReceived()
|
|
694
415
|
|
|
695
|
-
Runs when SAPI receives a bunch of offers
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
416
|
+
Runs when SAPI receives a bunch of offers\
|
|
417
|
+
Returns hotel's offers (incomplete response) in
|
|
418
|
+
`response.hotelOfferEntities` object as well as updated
|
|
419
|
+
hotel sort order in `response.hotelIds` array (sorted
|
|
420
|
+
according HSO and taking into account the real offers data)
|
|
699
421
|
|
|
700
422
|
5. onComplete()
|
|
701
423
|
|
|
702
|
-
Runs when current search is complete and all offers are retrieved
|
|
703
|
-
|
|
424
|
+
Runs when current search is complete and all offers are retrieved\
|
|
704
425
|
Return complete SAPI seearch response.
|
|
705
426
|
|
|
706
|
-
|
|
707
|
-
<a id="search-response"></a>
|
|
708
|
-
|
|
709
427
|
### Response
|
|
428
|
+
<a id="search-response"></a>
|
|
710
429
|
|
|
711
|
-
The complete SAPI search response is too big to be displayed on the page
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
430
|
+
The complete SAPI search response is too big to be displayed on the page
|
|
431
|
+
so there is a simplified example:
|
|
432
|
+
|
|
433
|
+
```js
|
|
434
|
+
{
|
|
435
|
+
"anchor": {
|
|
436
|
+
"admDivisionLevel1": "The Netherlands",
|
|
437
|
+
"admDivisionLevel2": "Amsterdam",
|
|
438
|
+
"admDivisionLevel3": "Bedrijventerrein Sloterdijk",
|
|
439
|
+
"hotelName": "Holiday Inn Express Amsterdam - Sloterdijk Station, an IHG Hotel",
|
|
440
|
+
"objectID": "hotel:1714808",
|
|
441
|
+
"objectType": "hotel",
|
|
442
|
+
"pageSize": 26,
|
|
443
|
+
"placeDisplayName": "Bedrijventerrein Sloterdijk, Amsterdam",
|
|
444
|
+
"priceBucketWidth": 19,
|
|
445
|
+
"_geoloc": {"lat": 52.388326, "lon": 4.837264, "precision": 5000, "radius": 20000}
|
|
446
|
+
},
|
|
447
|
+
"anchorHotelId": "1714808",
|
|
448
|
+
"anchorType": "hotel",
|
|
449
|
+
"dealScores": {"1041597": 0.06, "1041618": 0.37, "1041632": 0.75},
|
|
450
|
+
"facets": {
|
|
451
|
+
"facilities": {"1": 212, "2": 348, "3": 116},
|
|
452
|
+
"pricing.medianRateBkt": {"3": 4, "4": 12, "5": 19},
|
|
453
|
+
"pricing.medianRateMoFrBkt": {"3": 4, "4": 6, "5": 8, "6": 9},
|
|
454
|
+
"pricing.medianRateSaSuBkt": {"2": 2, "3": 4, "4": 6, "5": 10},
|
|
455
|
+
"pricing.minRateBkt": {"2": 22, "3": 38, "4": 46, "5": 98},
|
|
456
|
+
"propertyTypeId": {"0": 1030, "2": 6, "3": 601, "4": 86},
|
|
457
|
+
"starRating": {"1": 351, "2": 313, "3": 596, "4": 441, "5": 86},
|
|
458
|
+
"themeIds": {"1": 9, "2": 1373, "3": 143, "5": 1092, "8": 119},
|
|
459
|
+
},
|
|
460
|
+
"hotelEntities": {
|
|
461
|
+
"1041597": {
|
|
462
|
+
"chainID": "351",
|
|
463
|
+
"checkInTime": "15:00",
|
|
464
|
+
"checkOutTime": "12:00",
|
|
465
|
+
"country": "NL",
|
|
466
|
+
"displayAddress": "Stationsplein 49, Burgwallen-Nieuwe Zijde, Amsterdam, The Netherlands",
|
|
467
|
+
"facilities": [1, 2, 5, 8, 9, 11],
|
|
468
|
+
"guestRating": {"cleanliness": 7.94, "dining": 7.51, "facilities": 7.54, "location": 8.09, "overall": 7.83, "service": 8.8},
|
|
469
|
+
"guestType": {"business": 793, "couples": 2558, "families": 1145, "groups": 1276, "solo": 398},
|
|
470
|
+
"hotelName": "ibis Amsterdam Centre",
|
|
471
|
+
"imageURIs": ["https://i.travelapi.com/hotels/1000000/30000/25600/25525/c2387aed_w.jpg"],
|
|
472
|
+
"isDeleted": false,
|
|
473
|
+
"lastBooked": 1658320362,
|
|
474
|
+
"objectID": "1041597",
|
|
475
|
+
"parentChainID": "10",
|
|
476
|
+
"placeDisplayName": "Burgwallen-Nieuwe Zijde, Amsterdam",
|
|
477
|
+
"pricing": {"medianRateBkt": 12, "medianRateMoFrBkt": 13, "medianRateSaSuBkt": 11, "minRate": 116, "minRateBkt": 75, "minRateBkt": 5, "priced": 1},
|
|
478
|
+
"propertyTypeId": 0,
|
|
479
|
+
"regularPriceRange": [224, 243],
|
|
480
|
+
"reviewCount": 5766,
|
|
481
|
+
"sentiments": [177, 250, 300, 419],
|
|
482
|
+
"starRating": 3,
|
|
483
|
+
"tags": ["b220918-1"],
|
|
484
|
+
"themeIds": [2, 5, 12],
|
|
485
|
+
"_geoloc": {"lat": 52.37947, "lon": 4.89699}
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
"hotelIds": ["1840170", "2766940", "3310443", "3035769"],
|
|
489
|
+
"hotelOfferEntities": {
|
|
490
|
+
"1041597": {
|
|
491
|
+
"anchorPriceRateBreakdown": {
|
|
492
|
+
"baseRate": 244.6021305,
|
|
493
|
+
"calculatedTotalRate": 288.13897963499994,
|
|
494
|
+
"localTaxes": 23.122149135,
|
|
495
|
+
"nightlyRate": 288.13897963499994,
|
|
496
|
+
"taxes": 20.4147
|
|
766
497
|
},
|
|
767
|
-
"
|
|
768
|
-
"
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
"taxes": 20.4147
|
|
498
|
+
"availableOffersCount": 23,
|
|
499
|
+
"fetchedAllOffers": false,
|
|
500
|
+
"hasMoreOffers": true,
|
|
501
|
+
"id": "1041597",
|
|
502
|
+
"offers": [
|
|
503
|
+
{
|
|
504
|
+
"additionalProviderParams": {
|
|
505
|
+
"feedId": "1524856"
|
|
776
506
|
},
|
|
777
|
-
"
|
|
778
|
-
"
|
|
779
|
-
"
|
|
780
|
-
"
|
|
781
|
-
"
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
"proxyProviderCode": "BKS",
|
|
802
|
-
"rateBreakdown": {
|
|
803
|
-
"baseRate": 90.28,
|
|
804
|
-
"localTaxes": 12.32,
|
|
805
|
-
"taxes": 8.12
|
|
806
|
-
},
|
|
807
|
-
"roomID": "moc_08Ap8BcbIDg",
|
|
808
|
-
"roomName": "Standard Double Room",
|
|
809
|
-
"tags": ["top_offer"]
|
|
810
|
-
}
|
|
811
|
-
],
|
|
812
|
-
"topOfferData": {
|
|
813
|
-
"anchorPrice": 288.13897963499994,
|
|
814
|
-
"anchorPriceNightly": 288.13897963499994,
|
|
815
|
-
"offerIndexes": [0, 1, 2, 3]
|
|
816
|
-
}
|
|
507
|
+
"availableRooms": 10,
|
|
508
|
+
"bookURI": "https://r.findhotel.net?...",
|
|
509
|
+
"calculatedTotalRate": 110.72,
|
|
510
|
+
"canPayLater": true,
|
|
511
|
+
"cug": null,
|
|
512
|
+
"currency": "EUR",
|
|
513
|
+
"hasAnchorPrice": true,
|
|
514
|
+
"hasFreeCancellation": true,
|
|
515
|
+
"id": "oO8jdRHaO8y0",
|
|
516
|
+
"isAnchorPriceOffer": false,
|
|
517
|
+
"isCheapest": false,
|
|
518
|
+
"isTopOffer": true,
|
|
519
|
+
"meals": ["breakfast"],
|
|
520
|
+
"nightlyRate": 110.72,
|
|
521
|
+
"providerCode": "BKS",
|
|
522
|
+
"proxyProviderCode": "BKS",
|
|
523
|
+
"rateBreakdown": {
|
|
524
|
+
"baseRate": 90.28,
|
|
525
|
+
"localTaxes": 12.32,
|
|
526
|
+
"taxes": 8.12
|
|
527
|
+
},
|
|
528
|
+
"roomID": "moc_08Ap8BcbIDg",
|
|
529
|
+
"roomName": "Standard Double Room",
|
|
530
|
+
"tags": ["top_offer"]
|
|
817
531
|
}
|
|
818
|
-
|
|
819
|
-
"
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
"searchId": "0f9642a0-eab7-4acb-8313-bc6d19c408f6",
|
|
824
|
-
"searchParameters": {
|
|
825
|
-
"hotelId": "1714808",
|
|
826
|
-
"checkIn": "2022-09-01",
|
|
827
|
-
"checkOut": "2022-09-02",
|
|
828
|
-
"rooms": "2"
|
|
532
|
+
],
|
|
533
|
+
"topOfferData": {
|
|
534
|
+
"anchorPrice": 288.13897963499994,
|
|
535
|
+
"anchorPriceNightly": 288.13897963499994,
|
|
536
|
+
"offerIndexes": [0, 1, 2, 3]
|
|
829
537
|
}
|
|
830
538
|
}
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
539
|
+
},
|
|
540
|
+
"hotelsHaveStaticPosition": true,
|
|
541
|
+
"offset": 0,
|
|
542
|
+
"resultsCount": 26,
|
|
543
|
+
"resultsCountTotal": 3401,
|
|
544
|
+
"searchId": "0f9642a0-eab7-4acb-8313-bc6d19c408f6",
|
|
545
|
+
"searchParameters": {
|
|
546
|
+
"hotelId": "1714808",
|
|
547
|
+
"checkIn": "2022-09-01",
|
|
548
|
+
"checkOut": "2022-09-02",
|
|
549
|
+
"rooms": "2"
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
```
|
|
834
553
|
|
|
835
554
|
## `suggest()` method
|
|
555
|
+
<a id="suggest-method"></a>
|
|
836
556
|
|
|
837
557
|
Suggest provides autosuggestions for a given query
|
|
838
558
|
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
<a id="suggest-parameters"></a>
|
|
559
|
+
```js
|
|
560
|
+
const suggestions = await sapiClient.suggest('London', 6)
|
|
561
|
+
```
|
|
843
562
|
|
|
844
563
|
### Suggest parameters
|
|
564
|
+
<a id="suggest-parameters"></a>
|
|
845
565
|
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
<col class="org-left" />
|
|
851
|
-
|
|
852
|
-
<col class="org-left" />
|
|
853
|
-
|
|
854
|
-
<col class="org-left" />
|
|
855
|
-
|
|
856
|
-
<col class="org-left" />
|
|
857
|
-
|
|
858
|
-
<col class="org-left" />
|
|
859
|
-
</colgroup>
|
|
860
|
-
<thead>
|
|
861
|
-
<tr>
|
|
862
|
-
<th scope="col" class="org-left">name</th>
|
|
863
|
-
<th scope="col" class="org-left">type</th>
|
|
864
|
-
<th scope="col" class="org-left">description</th>
|
|
865
|
-
<th scope="col" class="org-left">required</th>
|
|
866
|
-
<th scope="col" class="org-left">example</th>
|
|
867
|
-
</tr>
|
|
868
|
-
</thead>
|
|
869
|
-
|
|
870
|
-
<tbody>
|
|
871
|
-
<tr>
|
|
872
|
-
<td class="org-left">`query`</td>
|
|
873
|
-
<td class="org-left">`string`</td>
|
|
874
|
-
<td class="org-left">Query string</td>
|
|
875
|
-
<td class="org-left">yes</td>
|
|
876
|
-
<td class="org-left">`London`</td>
|
|
877
|
-
</tr>
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
<tr>
|
|
881
|
-
<td class="org-left">`suggestsCount`</td>
|
|
882
|
-
<td class="org-left">`number`</td>
|
|
883
|
-
<td class="org-left">Desired number of suggestions (default 6)</td>
|
|
884
|
-
<td class="org-left">no</td>
|
|
885
|
-
<td class="org-left">`10`</td>
|
|
886
|
-
</tr>
|
|
887
|
-
</tbody>
|
|
888
|
-
</table>
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
<a id="suggest-response"></a>
|
|
566
|
+
| name | type | description | required | example |
|
|
567
|
+
| --------------- | -------- | ----------------------------------------- | -------- | -------- |
|
|
568
|
+
| `query` | `string` | Query string | yes | `London` |
|
|
569
|
+
| `suggestsCount` | `number` | Desired number of suggestions (default 6) | no | `10` |
|
|
892
570
|
|
|
893
571
|
### Response
|
|
572
|
+
<a id="suggest-response"></a>
|
|
894
573
|
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
<a id="rooms-method"></a>
|
|
574
|
+
```js
|
|
575
|
+
const suggestions = await sapiClient.suggest('London', 2)
|
|
576
|
+
|
|
577
|
+
[
|
|
578
|
+
{
|
|
579
|
+
"highlightValue": "<em>London</em>",
|
|
580
|
+
"objectID": "158584",
|
|
581
|
+
"objectType": "place",
|
|
582
|
+
"placeDisplayName": "United Kingdom",
|
|
583
|
+
"placeTypeName": "city",
|
|
584
|
+
"value": "London"
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
"highlightValue": "<em>London</em> Heathrow Airport",
|
|
588
|
+
"objectID": "167733",
|
|
589
|
+
"objectType": "place",
|
|
590
|
+
"placeDisplayName": "London, United Kingdom",
|
|
591
|
+
"placeTypeName": "airport",
|
|
592
|
+
"value": "London Heathrow Airport"
|
|
593
|
+
}
|
|
594
|
+
]
|
|
595
|
+
|
|
596
|
+
const suggestions = await sapiClient.suggest('London hotel', 2)
|
|
597
|
+
|
|
598
|
+
[
|
|
599
|
+
{
|
|
600
|
+
"highlightValue": "Park Plaza Westminster Bridge <em>London</em>",
|
|
601
|
+
"objectID": "1546646",
|
|
602
|
+
"objectType": "hotel",
|
|
603
|
+
"placeDisplayName": "London, United Kingdom",
|
|
604
|
+
"placeTypeName": "property",
|
|
605
|
+
"value": "Park Plaza Westminster Bridge London"
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
"highlightValue": "Hampton by Hilton <em>London</em> Stansted Airport",
|
|
609
|
+
"objectID": "3333916",
|
|
610
|
+
"objectType": "hotel",
|
|
611
|
+
"placeDisplayName": "United Kingdom",
|
|
612
|
+
"placeTypeName": "property",
|
|
613
|
+
"value": "Hampton by Hilton London Stansted Airport"
|
|
614
|
+
}
|
|
615
|
+
]
|
|
616
|
+
```
|
|
939
617
|
|
|
940
618
|
## `rooms()` method
|
|
619
|
+
<a id="rooms-method"></a>
|
|
941
620
|
|
|
942
621
|
Rooms is a method of **sapiClient** for retrieving rooms information and
|
|
943
622
|
offers for a particular itinerary:
|
|
944
623
|
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
<a id="rooms-parameters"></a>
|
|
624
|
+
```js
|
|
625
|
+
const rooms = await sapiClient.rooms({
|
|
626
|
+
hotelId: '1714808',
|
|
627
|
+
checkIn: '2021-10-10',
|
|
628
|
+
checkOut: '2021-10-11',
|
|
629
|
+
rooms: '2'
|
|
630
|
+
})
|
|
631
|
+
```
|
|
954
632
|
|
|
955
633
|
### Rooms parameters
|
|
634
|
+
<a id="rooms-parameters"></a>
|
|
956
635
|
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
<thead>
|
|
972
|
-
<tr>
|
|
973
|
-
<th scope="col" class="org-left">name</th>
|
|
974
|
-
<th scope="col" class="org-left">type</th>
|
|
975
|
-
<th scope="col" class="org-left">description</th>
|
|
976
|
-
<th scope="col" class="org-left">required</th>
|
|
977
|
-
<th scope="col" class="org-left">example</th>
|
|
978
|
-
</tr>
|
|
979
|
-
</thead>
|
|
980
|
-
|
|
981
|
-
<tbody>
|
|
982
|
-
<tr>
|
|
983
|
-
<td class="org-left">`hotelId`</td>
|
|
984
|
-
<td class="org-left">`string`</td>
|
|
985
|
-
<td class="org-left">Hotel Id to retrieve rooms</td>
|
|
986
|
-
<td class="org-left">yes</td>
|
|
987
|
-
<td class="org-left">`1714808`</td>
|
|
988
|
-
</tr>
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
<tr>
|
|
992
|
-
<td class="org-left">`checkIn`</td>
|
|
993
|
-
<td class="org-left">`string`</td>
|
|
994
|
-
<td class="org-left">Check in date (`YYYY-MM-DD`)</td>
|
|
995
|
-
<td class="org-left">yes</td>
|
|
996
|
-
<td class="org-left">`2021-10-10`</td>
|
|
997
|
-
</tr>
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
<tr>
|
|
1001
|
-
<td class="org-left">`checkOut`</td>
|
|
1002
|
-
<td class="org-left">`string`</td>
|
|
1003
|
-
<td class="org-left">Check out date (`YYYY-MM-DD`)</td>
|
|
1004
|
-
<td class="org-left">yes</td>
|
|
1005
|
-
<td class="org-left">`2021-10-11`</td>
|
|
1006
|
-
</tr>
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
<tr>
|
|
1010
|
-
<td class="org-left">`rooms`</td>
|
|
1011
|
-
<td class="org-left">`string`</td>
|
|
1012
|
-
<td class="org-left">[Rooms configuration](https://github.com/FindHotel/search-data-pipelines/wiki/Glossary#rooms-configuration)</td>
|
|
1013
|
-
<td class="org-left">yes</td>
|
|
1014
|
-
<td class="org-left">`2`</td>
|
|
1015
|
-
</tr>
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
<tr>
|
|
1019
|
-
<td class="org-left">`providerCode`</td>
|
|
1020
|
-
<td class="org-left">`string`</td>
|
|
1021
|
-
<td class="org-left">Provider code used for retrieving rooms offers</td>
|
|
1022
|
-
<td class="org-left">no</td>
|
|
1023
|
-
<td class="org-left">`GAR`</td>
|
|
1024
|
-
</tr>
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
<tr>
|
|
1028
|
-
<td class="org-left">`cugDeals`</td>
|
|
1029
|
-
<td class="org-left">`string`</td>
|
|
1030
|
-
<td class="org-left">Type of cug (closed user group) deals to retrieve</td>
|
|
1031
|
-
<td class="org-left">no</td>
|
|
1032
|
-
<td class="org-left">`signed_in,offline`</td>
|
|
1033
|
-
</tr>
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
<tr>
|
|
1037
|
-
<td class="org-left">`tier`</td>
|
|
1038
|
-
<td class="org-left">`string`</td>
|
|
1039
|
-
<td class="org-left">User tier</td>
|
|
1040
|
-
<td class="org-left">no</td>
|
|
1041
|
-
<td class="org-left">`plus`</td>
|
|
1042
|
-
</tr>
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
<tr>
|
|
1046
|
-
<td class="org-left">`clickedOfferId`</td>
|
|
1047
|
-
<td class="org-left">`string`</td>
|
|
1048
|
-
<td class="org-left">Offer id that user clicked on SRP (Will be used to promote the offer to the top of the list)</td>
|
|
1049
|
-
<td class="org-left">no</td>
|
|
1050
|
-
<td class="org-left">`oXstvXafDb2o`</td>
|
|
1051
|
-
</tr>
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
<tr>
|
|
1055
|
-
<td class="org-left">`preHeat`</td>
|
|
1056
|
-
<td class="org-left">`number`</td>
|
|
1057
|
-
<td class="org-left">Enables pre-heat mode</td>
|
|
1058
|
-
<td class="org-left">no</td>
|
|
1059
|
-
<td class="org-left">`1`</td>
|
|
1060
|
-
</tr>
|
|
1061
|
-
</tbody>
|
|
1062
|
-
</table>
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
<a id="rooms-response"></a>
|
|
636
|
+
| name | type | description | required | example |
|
|
637
|
+
| ----------------------- | -------- | ----------------------------------------------------------------------------------------------------------- | -------- | ------------------- |
|
|
638
|
+
| `hotelId` | `string` | Hotel Id to retrieve rooms | yes | `1714808` |
|
|
639
|
+
| `checkIn` | `string` | Check in date (`YYYY-MM-DD`) | yes | `2021-10-10` |
|
|
640
|
+
| `checkOut` | `string` | Check out date (`YYYY-MM-DD`) | yes | `2021-10-11` |
|
|
641
|
+
| `rooms` | `string` | [Rooms configuration](https://github.com/FindHotel/search-data-pipelines/wiki/Glossary#rooms-configuration) | yes | `2` |
|
|
642
|
+
| `providerCode` | `string` | Provider code used for retrieving rooms offers | no | `GAR` |
|
|
643
|
+
| `cugDeals` | `string` | Type of cug (closed user group) deals to retrieve | no | `signed_in,offline` |
|
|
644
|
+
| `tier` | `string` | User tier | no | `plus` |
|
|
645
|
+
| `clickedOfferId` | `string` | Offer id that user clicked on SRP | no | `oXstvXafDb2o` |
|
|
646
|
+
| `clickedOfferBaseRate` | `number` | Base rate value of the offer which user clicked on SRP | no | `25` |
|
|
647
|
+
| `clickedOfferTaxes` | `number` | Taxes value of the offer which user clicked on SRP | no | `10` |
|
|
648
|
+
| `clickedOfferHotelFees` | `number` | Hotel fees value of the offer which the user clicked on SRP | no | `5` |
|
|
649
|
+
| `preHeat` | `number` | Enables pre-heat mode | no | `1` |
|
|
1066
650
|
|
|
1067
651
|
### Response
|
|
652
|
+
<a id="rooms-response"></a>
|
|
1068
653
|
|
|
654
|
+
```js
|
|
655
|
+
{
|
|
656
|
+
"anonymousId": "fd9dbb5f-b337-4dd7-b640-1f177d1d3caa",
|
|
657
|
+
"hotelId": "1714808",
|
|
658
|
+
"rooms": [
|
|
1069
659
|
{
|
|
1070
|
-
"
|
|
1071
|
-
"
|
|
1072
|
-
"
|
|
660
|
+
"amenities": ["Non-Smoking Facility"],
|
|
661
|
+
"bedTypes": [],
|
|
662
|
+
"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",
|
|
663
|
+
"id": "K0LnAe-G9WI",
|
|
664
|
+
"images": [{"url": "http://images.getaroom-cdn.com/image/....}],
|
|
665
|
+
"masterId": "9643931",
|
|
666
|
+
"name": "1 Double Standard",
|
|
667
|
+
"offers": [
|
|
1073
668
|
{
|
|
1074
|
-
"
|
|
1075
|
-
"
|
|
1076
|
-
"
|
|
1077
|
-
"
|
|
1078
|
-
"
|
|
1079
|
-
"
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
"chargeable": {"base": "1352.77", "taxes": "59.94", "total": "1412.71"},
|
|
1095
|
-
"currencyCode": "EUR",
|
|
1096
|
-
"hotelFees": {"breakdown": [], "total": "0"},
|
|
1097
|
-
"type": "chargeable_currency"
|
|
1098
|
-
}],
|
|
1099
|
-
"providerCode": "GAR",
|
|
1100
|
-
"providerRateType": "public",
|
|
1101
|
-
"refundable": false,
|
|
1102
|
-
"services": ["breakfast"]
|
|
1103
|
-
}
|
|
1104
|
-
]
|
|
669
|
+
"availableRooms": 0,
|
|
670
|
+
"canPayLater": false,
|
|
671
|
+
"cancellationPenalties": [],
|
|
672
|
+
"cug": ["signed_in"],
|
|
673
|
+
"id": "o0KDe_mFPN4k",
|
|
674
|
+
"links": [{
|
|
675
|
+
"href": "https://secure.findhotel.net/checkout/?hotelID=1714808...",
|
|
676
|
+
"method": "GET",
|
|
677
|
+
"type": "checkout"
|
|
678
|
+
}],
|
|
679
|
+
"prices": [{
|
|
680
|
+
"chargeable": {"base": "1352.77", "taxes": "59.94", "total": "1412.71"},
|
|
681
|
+
"currencyCode": "EUR",
|
|
682
|
+
"hotelFees": {"breakdown": [], "total": "0"},
|
|
683
|
+
"type": "chargeable_currency"
|
|
684
|
+
}],
|
|
685
|
+
"providerCode": "GAR",
|
|
686
|
+
"providerRateType": "public",
|
|
687
|
+
"refundable": false,
|
|
688
|
+
"services": ["breakfast"]
|
|
1105
689
|
}
|
|
1106
690
|
]
|
|
1107
691
|
}
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
692
|
+
]
|
|
693
|
+
}
|
|
694
|
+
```
|
|
1111
695
|
|
|
1112
696
|
## `hotel()` method
|
|
697
|
+
<a id="hotel-method"></a>
|
|
1113
698
|
|
|
1114
699
|
Hotel is a method of **sapiClient** for retrieving a single hotel by id
|
|
1115
700
|
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
<a id="hotel-parameters"></a>
|
|
701
|
+
```js
|
|
702
|
+
const hotel = await sapiClient.hotel('1196472')
|
|
703
|
+
```
|
|
1120
704
|
|
|
1121
705
|
### Hotel parameters
|
|
706
|
+
<a id="hotel-parameters"></a>
|
|
1122
707
|
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
<colgroup>
|
|
1127
|
-
<col class="org-left" />
|
|
1128
|
-
|
|
1129
|
-
<col class="org-left" />
|
|
1130
|
-
|
|
1131
|
-
<col class="org-left" />
|
|
1132
|
-
|
|
1133
|
-
<col class="org-left" />
|
|
1134
|
-
|
|
1135
|
-
<col class="org-left" />
|
|
1136
|
-
</colgroup>
|
|
1137
|
-
<thead>
|
|
1138
|
-
<tr>
|
|
1139
|
-
<th scope="col" class="org-left">name</th>
|
|
1140
|
-
<th scope="col" class="org-left">type</th>
|
|
1141
|
-
<th scope="col" class="org-left">description</th>
|
|
1142
|
-
<th scope="col" class="org-left">required</th>
|
|
1143
|
-
<th scope="col" class="org-left">example</th>
|
|
1144
|
-
</tr>
|
|
1145
|
-
</thead>
|
|
1146
|
-
|
|
1147
|
-
<tbody>
|
|
1148
|
-
<tr>
|
|
1149
|
-
<td class="org-left">`hotelId`</td>
|
|
1150
|
-
<td class="org-left">`string`</td>
|
|
1151
|
-
<td class="org-left">Hotel Id</td>
|
|
1152
|
-
<td class="org-left">yes</td>
|
|
1153
|
-
<td class="org-left">`1196472`</td>
|
|
1154
|
-
</tr>
|
|
1155
|
-
</tbody>
|
|
1156
|
-
</table>
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
<a id="hotel-response"></a>
|
|
708
|
+
| name | type | description | required | example |
|
|
709
|
+
| --------- | -------- | ----------- | -------- | --------- |
|
|
710
|
+
| `hotelId` | `string` | Hotel Id | yes | `1196472` |
|
|
1160
711
|
|
|
1161
712
|
### Response
|
|
713
|
+
<a id="hotel-response"></a>
|
|
1162
714
|
|
|
1163
|
-
An example of the response for request with `hotelId` 1196472
|
|
1164
|
-
|
|
715
|
+
An example of the response for request with `hotelId` 1196472
|
|
716
|
+
and \"pt-BR\" `language`
|
|
717
|
+
|
|
718
|
+
```js
|
|
719
|
+
{
|
|
720
|
+
"objectID": "1196472",
|
|
721
|
+
"guestRating": {
|
|
722
|
+
"cleanliness": 8.82,
|
|
723
|
+
"dining": 8.73,
|
|
724
|
+
"facilities": 8.73,
|
|
725
|
+
"location": 8.8,
|
|
726
|
+
"overall": 8.54,
|
|
727
|
+
"pricing": 4.49,
|
|
728
|
+
"rooms": 8.82,
|
|
729
|
+
"service": 8.67
|
|
730
|
+
},
|
|
731
|
+
"isDeleted": false,
|
|
732
|
+
"starRating": 4,
|
|
733
|
+
"_geoloc": {
|
|
734
|
+
"lat": 52.377805,
|
|
735
|
+
"lon": 4.914172
|
|
736
|
+
},
|
|
737
|
+
"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> <li>Taxa para o acesso à internet com fio em áreas comuns: EUR 15 por dia (as tarifas podem variar)</li> <li>Taxa para estacionamento coberto sem manobrista: EUR 38.00 por dia</li> <li>Estacionamento pago nos arredores: EUR 15 por dia (aberto 24 horas)</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>",
|
|
738
|
+
"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.",
|
|
739
|
+
"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><li>O estabelecimento possui quartos conectados ou adjacentes, que podem ser solicitados entrando-se em contato diretamente com o estabelecimento, através do número fornecido na confirmação da reserva. </li><li>Não há necessidade de carro para o transporte de/para o estabelecimento. </li><p>Há restrições de altura no estacionamento. </p><li>Medidas de limpeza aprimorada e segurança dos hóspedes estão atualmente em vigor nesta acomodação.</li><li>A limpeza do estabelecimento é feita com desinfetante, as superfícies tocadas regularmente são desinfetadas entre as estadias e os lençóis e as toalhas são lavados a uma temperatura mínima de 60 °C.</li><li>Equipamentos de proteção individuais , como máscaras, vão estar disponíveis para os hóspedes.</li><li>Medidas de distanciamento social estão em vigor; os funcionários utilizam equipamento de proteção individual no estabelecimento; há um painel protetor de acrílico entre funcionários e hóspedes nas principais áreas de contato; os hóspedes recebem álcool em gel.</li><li>Há possibilidade de check-in sem contato e check-out sem contato.</li><li>Cada quarto permanece vazio por um mínimo de 24 horas entre as estadias.</li><li> Este estabelecimento recebe hóspedes de todas as orientações sexuais e identidades de gênero (LGBTQ friendly). </li> </ul>",
|
|
740
|
+
"phone": "+31205191200",
|
|
741
|
+
"imageURIs": [
|
|
742
|
+
"https://i.travelapi.com/hotels/2000000/1460000/1452100/1452083/a39e2fc8_w.jpg",
|
|
743
|
+
"https://i.travelapi.com/hotels/2000000/1460000/1452100/1452083/3892e861_w.jpg",
|
|
744
|
+
"https://i.travelapi.com/hotels/2000000/1460000/1452100/1452083/aed25438_w.jpg"
|
|
745
|
+
],
|
|
746
|
+
"checkInTime": "15:00",
|
|
747
|
+
"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><li>Solicitações especiais estão sujeitas à disponibilidade no momento do check-in e podem incorrer em taxas adicionais. Essas solicitações não estão garantidas</li><li>Políticas de cancelamento ou cobranças especiais podem se aplicar a reservas de grupos (mais de 8 quartos para o mesmo estabelecimento/mesmas datas)</li><li>Este estabelecimento aceita cartões de crédito – não são aceitos pagamentos em dinheiro.</li><li>Os recursos de segurança disponíveis no estabelecimento incluem itens como detector de fumaça</li><li>As normas culturais e políticas de hóspedes podem variar conforme o país e o estabelecimento. As políticas listadas são fornecidas pelo estabelecimento</li> </ul>",
|
|
748
|
+
"reviewCount": 17538,
|
|
749
|
+
"chainID": "2101",
|
|
750
|
+
"checkInEnd": "01:00",
|
|
751
|
+
"lastBooked": 1608030831,
|
|
752
|
+
"checkOutTime": "12:00",
|
|
753
|
+
"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>",
|
|
754
|
+
"reviewCountBkt": 9,
|
|
755
|
+
"hotelName": "Movenpick Hotel Amsterdam City Centre",
|
|
756
|
+
"sentiments": [{
|
|
757
|
+
"value": "Gostou do bar",
|
|
758
|
+
"id": 46
|
|
759
|
+
},
|
|
1165
760
|
{
|
|
1166
|
-
"
|
|
1167
|
-
"
|
|
1168
|
-
"cleanliness": 8.82,
|
|
1169
|
-
"dining": 8.73,
|
|
1170
|
-
"facilities": 8.73,
|
|
1171
|
-
"location": 8.8,
|
|
1172
|
-
"overall": 8.54,
|
|
1173
|
-
"pricing": 4.49,
|
|
1174
|
-
"rooms": 8.82,
|
|
1175
|
-
"service": 8.67
|
|
1176
|
-
},
|
|
1177
|
-
"isDeleted": false,
|
|
1178
|
-
"starRating": 4,
|
|
1179
|
-
"_geoloc": {
|
|
1180
|
-
"lat": 52.377805,
|
|
1181
|
-
"lon": 4.914172
|
|
1182
|
-
},
|
|
1183
|
-
"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> <li>Taxa para o acesso à internet com fio em áreas comuns: EUR 15 por dia (as tarifas podem variar)</li> <li>Taxa para estacionamento coberto sem manobrista: EUR 38.00 por dia</li> <li>Estacionamento pago nos arredores: EUR 15 por dia (aberto 24 horas)</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>",
|
|
1184
|
-
"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.",
|
|
1185
|
-
"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><li>O estabelecimento possui quartos conectados ou adjacentes, que podem ser solicitados entrando-se em contato diretamente com o estabelecimento, através do número fornecido na confirmação da reserva. </li><li>Não há necessidade de carro para o transporte de/para o estabelecimento. </li><p>Há restrições de altura no estacionamento. </p><li>Medidas de limpeza aprimorada e segurança dos hóspedes estão atualmente em vigor nesta acomodação.</li><li>A limpeza do estabelecimento é feita com desinfetante, as superfícies tocadas regularmente são desinfetadas entre as estadias e os lençóis e as toalhas são lavados a uma temperatura mínima de 60 °C.</li><li>Equipamentos de proteção individuais , como máscaras, vão estar disponíveis para os hóspedes.</li><li>Medidas de distanciamento social estão em vigor; os funcionários utilizam equipamento de proteção individual no estabelecimento; há um painel protetor de acrílico entre funcionários e hóspedes nas principais áreas de contato; os hóspedes recebem álcool em gel.</li><li>Há possibilidade de check-in sem contato e check-out sem contato.</li><li>Cada quarto permanece vazio por um mínimo de 24 horas entre as estadias.</li><li> Este estabelecimento recebe hóspedes de todas as orientações sexuais e identidades de gênero (LGBTQ friendly). </li> </ul>",
|
|
1186
|
-
"phone": "+31205191200",
|
|
1187
|
-
"imageURIs": [
|
|
1188
|
-
"https://i.travelapi.com/hotels/2000000/1460000/1452100/1452083/a39e2fc8_w.jpg",
|
|
1189
|
-
"https://i.travelapi.com/hotels/2000000/1460000/1452100/1452083/3892e861_w.jpg",
|
|
1190
|
-
"https://i.travelapi.com/hotels/2000000/1460000/1452100/1452083/aed25438_w.jpg"
|
|
1191
|
-
],
|
|
1192
|
-
"checkInTime": "15:00",
|
|
1193
|
-
"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><li>Solicitações especiais estão sujeitas à disponibilidade no momento do check-in e podem incorrer em taxas adicionais. Essas solicitações não estão garantidas</li><li>Políticas de cancelamento ou cobranças especiais podem se aplicar a reservas de grupos (mais de 8 quartos para o mesmo estabelecimento/mesmas datas)</li><li>Este estabelecimento aceita cartões de crédito – não são aceitos pagamentos em dinheiro.</li><li>Os recursos de segurança disponíveis no estabelecimento incluem itens como detector de fumaça</li><li>As normas culturais e políticas de hóspedes podem variar conforme o país e o estabelecimento. As políticas listadas são fornecidas pelo estabelecimento</li> </ul>",
|
|
1194
|
-
"reviewCount": 17538,
|
|
1195
|
-
"chainID": "2101",
|
|
1196
|
-
"checkInEnd": "01:00",
|
|
1197
|
-
"lastBooked": 1608030831,
|
|
1198
|
-
"checkOutTime": "12:00",
|
|
1199
|
-
"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>",
|
|
1200
|
-
"reviewCountBkt": 9,
|
|
1201
|
-
"hotelName": "Movenpick Hotel Amsterdam City Centre",
|
|
1202
|
-
"sentiments": [{
|
|
1203
|
-
"value": "Gostou do bar",
|
|
1204
|
-
"id": 46
|
|
1205
|
-
},
|
|
1206
|
-
{
|
|
1207
|
-
"value": "Processo rápido de check-in/check-out",
|
|
1208
|
-
"id": 180
|
|
1209
|
-
}
|
|
1210
|
-
],
|
|
1211
|
-
"facilities": [{
|
|
1212
|
-
"categoryID": 4,
|
|
1213
|
-
"importance": 2,
|
|
1214
|
-
"value": "Centro de Negócios",
|
|
1215
|
-
"id": 1
|
|
1216
|
-
},
|
|
1217
|
-
{
|
|
1218
|
-
"categoryID": 17,
|
|
1219
|
-
"importance": 2,
|
|
1220
|
-
"value": "Serviço de quarto",
|
|
1221
|
-
"id": 2
|
|
1222
|
-
}
|
|
1223
|
-
],
|
|
1224
|
-
"placeID": "311007",
|
|
1225
|
-
"guestType": {
|
|
1226
|
-
"business": 1333,
|
|
1227
|
-
"couples": 3125,
|
|
1228
|
-
"families": 1484,
|
|
1229
|
-
"groups": 1121,
|
|
1230
|
-
"solo": 206
|
|
1231
|
-
},
|
|
1232
|
-
"themes": [{
|
|
1233
|
-
"value": "Cidade",
|
|
1234
|
-
"id": 2
|
|
1235
|
-
},
|
|
1236
|
-
{
|
|
1237
|
-
"value": "Empresarial",
|
|
1238
|
-
"id": 12
|
|
1239
|
-
}
|
|
1240
|
-
],
|
|
1241
|
-
"propertyType": {
|
|
1242
|
-
"value": "Hotel",
|
|
1243
|
-
"id": 0
|
|
1244
|
-
},
|
|
1245
|
-
"placeDisplayName": "Oostelijk Havengebied, Amsterdã",
|
|
1246
|
-
"displayAddress": "Piet Heinkade 11, Oostelijk Havengebied, Amsterdã, Holanda"
|
|
761
|
+
"value": "Processo rápido de check-in/check-out",
|
|
762
|
+
"id": 180
|
|
1247
763
|
}
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
764
|
+
],
|
|
765
|
+
"facilities": [{
|
|
766
|
+
"categoryID": 4,
|
|
767
|
+
"importance": 2,
|
|
768
|
+
"value": "Centro de Negócios",
|
|
769
|
+
"id": 1
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
"categoryID": 17,
|
|
773
|
+
"importance": 2,
|
|
774
|
+
"value": "Serviço de quarto",
|
|
775
|
+
"id": 2
|
|
776
|
+
}
|
|
777
|
+
],
|
|
778
|
+
"placeID": "311007",
|
|
779
|
+
"guestType": {
|
|
780
|
+
"business": 1333,
|
|
781
|
+
"couples": 3125,
|
|
782
|
+
"families": 1484,
|
|
783
|
+
"groups": 1121,
|
|
784
|
+
"solo": 206
|
|
785
|
+
},
|
|
786
|
+
"themes": [{
|
|
787
|
+
"value": "Cidade",
|
|
788
|
+
"id": 2
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
"value": "Empresarial",
|
|
792
|
+
"id": 12
|
|
793
|
+
}
|
|
794
|
+
],
|
|
795
|
+
"propertyType": {
|
|
796
|
+
"value": "Hotel",
|
|
797
|
+
"id": 0
|
|
798
|
+
},
|
|
799
|
+
"placeDisplayName": "Oostelijk Havengebied, Amsterdã",
|
|
800
|
+
"displayAddress": "Piet Heinkade 11, Oostelijk Havengebied, Amsterdã, Holanda"
|
|
801
|
+
}
|
|
802
|
+
```
|
|
1251
803
|
|
|
1252
804
|
## `offers()` method
|
|
805
|
+
<a id="offers-method"></a>
|
|
1253
806
|
|
|
1254
807
|
Retrieves offers for a single hotel by provided parameters
|
|
1255
808
|
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
<a id="hotel-parameters"></a>
|
|
809
|
+
```js
|
|
810
|
+
const parameters = {
|
|
811
|
+
hotelId: '1196472',
|
|
812
|
+
checkIn: '2022-10-10',
|
|
813
|
+
checkOut: '2022-10-11',
|
|
814
|
+
rooms: '2'
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
const callbacks = {
|
|
818
|
+
onStart: (response) => {
|
|
819
|
+
log('Offers started', response)
|
|
820
|
+
},
|
|
821
|
+
onOffersReceived: (response) => {
|
|
822
|
+
log('Offers received', response)
|
|
823
|
+
},
|
|
824
|
+
onComplete: (response) => {
|
|
825
|
+
log('Offers completed', response)
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
const offers = await sapiClient.offers(parameters, callbacks)
|
|
830
|
+
```
|
|
1279
831
|
|
|
1280
832
|
### Offers parameters
|
|
833
|
+
<a id="hotel-parameters"></a>
|
|
1281
834
|
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
<thead>
|
|
1297
|
-
<tr>
|
|
1298
|
-
<th scope="col" class="org-left">name</th>
|
|
1299
|
-
<th scope="col" class="org-left">type</th>
|
|
1300
|
-
<th scope="col" class="org-left">description</th>
|
|
1301
|
-
<th scope="col" class="org-left">required</th>
|
|
1302
|
-
<th scope="col" class="org-left">example</th>
|
|
1303
|
-
</tr>
|
|
1304
|
-
</thead>
|
|
1305
|
-
|
|
1306
|
-
<tbody>
|
|
1307
|
-
<tr>
|
|
1308
|
-
<td class="org-left">`hotelId`</td>
|
|
1309
|
-
<td class="org-left">`string`</td>
|
|
1310
|
-
<td class="org-left">Hotel Id</td>
|
|
1311
|
-
<td class="org-left">yes</td>
|
|
1312
|
-
<td class="org-left">`1196472`</td>
|
|
1313
|
-
</tr>
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
<tr>
|
|
1317
|
-
<td class="org-left">`checkIn`</td>
|
|
1318
|
-
<td class="org-left">`string`</td>
|
|
1319
|
-
<td class="org-left">Check in date (YYYY-MM-DD) (SDK generates default date if no provided)</td>
|
|
1320
|
-
<td class="org-left">no</td>
|
|
1321
|
-
<td class="org-left">`2022-10-10`</td>
|
|
1322
|
-
</tr>
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
<tr>
|
|
1326
|
-
<td class="org-left">`checkOut`</td>
|
|
1327
|
-
<td class="org-left">`string`</td>
|
|
1328
|
-
<td class="org-left">Check out date (YYYY-MM-DD)) (SDK generates default date if no provided)</td>
|
|
1329
|
-
<td class="org-left">no</td>
|
|
1330
|
-
<td class="org-left">`2022-10-11`</td>
|
|
1331
|
-
</tr>
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
<tr>
|
|
1335
|
-
<td class="org-left">`rooms`</td>
|
|
1336
|
-
<td class="org-left">`string`</td>
|
|
1337
|
-
<td class="org-left">[Rooms configuration](https://github.com/FindHotel/search-data-pipelines/wiki/Glossary#rooms-configuration)</td>
|
|
1338
|
-
<td class="org-left">no</td>
|
|
1339
|
-
<td class="org-left">`2`</td>
|
|
1340
|
-
</tr>
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
<tr>
|
|
1344
|
-
<td class="org-left">`searchId`</td>
|
|
1345
|
-
<td class="org-left">`string`</td>
|
|
1346
|
-
<td class="org-left">SearchId override (SDK generates a new one if no provided)</td>
|
|
1347
|
-
<td class="org-left">no</td>
|
|
1348
|
-
<td class="org-left">`08230dfcc5f0fb95caaa82ce559ea60c4a975d6f`</td>
|
|
1349
|
-
</tr>
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
<tr>
|
|
1353
|
-
<td class="org-left">`cugDeals`</td>
|
|
1354
|
-
<td class="org-left">`string[]`</td>
|
|
1355
|
-
<td class="org-left">Codes of closed user group deals to retrieve offers</td>
|
|
1356
|
-
<td class="org-left">no</td>
|
|
1357
|
-
<td class="org-left">`['signed_in', 'offline']`</td>
|
|
1358
|
-
</tr>
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
<tr>
|
|
1362
|
-
<td class="org-left">`tier`</td>
|
|
1363
|
-
<td class="org-left">`string`</td>
|
|
1364
|
-
<td class="org-left">User tier</td>
|
|
1365
|
-
<td class="org-left">no</td>
|
|
1366
|
-
<td class="org-left">`member`</td>
|
|
1367
|
-
</tr>
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
<tr>
|
|
1371
|
-
<td class="org-left">`freeCancellation`</td>
|
|
1372
|
-
<td class="org-left">`boolean`</td>
|
|
1373
|
-
<td class="org-left">Promote offers with free cancelation (default `false`)</td>
|
|
1374
|
-
<td class="org-left">no</td>
|
|
1375
|
-
<td class="org-left">`true`</td>
|
|
1376
|
-
</tr>
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
<tr>
|
|
1380
|
-
<td class="org-left">`isAnchor`</td>
|
|
1381
|
-
<td class="org-left">`boolean`</td>
|
|
1382
|
-
<td class="org-left">Anchor/Non anchor hotel (default `false`)</td>
|
|
1383
|
-
<td class="org-left">no</td>
|
|
1384
|
-
<td class="org-left">`true`</td>
|
|
1385
|
-
</tr>
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
<tr>
|
|
1389
|
-
<td class="org-left">`getAllOffers`</td>
|
|
1390
|
-
<td class="org-left">`boolean`</td>
|
|
1391
|
-
<td class="org-left">Get all/only top offers (default `false`)</td>
|
|
1392
|
-
<td class="org-left">no</td>
|
|
1393
|
-
<td class="org-left">`true`</td>
|
|
1394
|
-
</tr>
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
<tr>
|
|
1398
|
-
<td class="org-left">`originId`</td>
|
|
1399
|
-
<td class="org-left">`string`</td>
|
|
1400
|
-
<td class="org-left">Identifier of origin where the request was originated</td>
|
|
1401
|
-
<td class="org-left">no</td>
|
|
1402
|
-
<td class="org-left">`c3po6twr70`</td>
|
|
1403
|
-
</tr>
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
<tr>
|
|
1407
|
-
<td class="org-left">`trafficSource`</td>
|
|
1408
|
-
<td class="org-left">`string`</td>
|
|
1409
|
-
<td class="org-left">Visitor's traffic source. Opaque value that will be passed to tracking systems</td>
|
|
1410
|
-
<td class="org-left">no</td>
|
|
1411
|
-
<td class="org-left">`gha-vr`</td>
|
|
1412
|
-
</tr>
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
<tr>
|
|
1416
|
-
<td class="org-left">`preferredRate`</td>
|
|
1417
|
-
<td class="org-left">`number`</td>
|
|
1418
|
-
<td class="org-left">Offer's price user saw on a CA (meta) platform</td>
|
|
1419
|
-
<td class="org-left">no</td>
|
|
1420
|
-
<td class="org-left">`196`</td>
|
|
1421
|
-
</tr>
|
|
1422
|
-
</tbody>
|
|
1423
|
-
</table>
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
<a id="offers-callbacks"></a>
|
|
835
|
+
| name | type | description | required | example |
|
|
836
|
+
| ------------------ | ---------- | ----------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------ |
|
|
837
|
+
| `hotelId` | `string` | Hotel Id | yes | `1196472` |
|
|
838
|
+
| `checkIn` | `string` | Check in date (YYYY-MM-DD) (SDK generates default date if no provided) | no | `2022-10-10` |
|
|
839
|
+
| `checkOut` | `string` | Check out date (YYYY-MM-DD)) (SDK generates default date if no provided) | no | `2022-10-11` |
|
|
840
|
+
| `rooms` | `string` | [Rooms configuration](https://github.com/FindHotel/search-data-pipelines/wiki/Glossary#rooms-configuration) | no | `2` |
|
|
841
|
+
| `searchId` | `string` | SearchId override (SDK generates a new one if no provided) | no | `08230dfcc5f0fb95caaa82ce559ea60c4a975d6f` |
|
|
842
|
+
| `cugDeals` | `string[]` | Codes of closed user group deals to retrieve offers | no | `['signed_in', 'offline']` |
|
|
843
|
+
| `tier` | `string` | User tier | no | `member` |
|
|
844
|
+
| `freeCancellation` | `boolean` | Promote offers with free cancelation (default `false`) | no | `true` |
|
|
845
|
+
| `isAnchor` | `boolean` | Anchor/Non anchor hotel (default `false`) | no | `true` |
|
|
846
|
+
| `originId` | `string` | Identifier of origin where the request was originated | no | `c3po6twr70` |
|
|
847
|
+
| `trafficSource` | `string` | Visitor\'s traffic source. Opaque value that will be passed to tracking systems | no | `gha-vr` |
|
|
848
|
+
| `preferredRate` | `number` | Offer\'s price user saw on a CA (meta) platform | no | `196` |
|
|
1427
849
|
|
|
1428
850
|
### Callbacks
|
|
851
|
+
<a id="offers-callbacks"></a>
|
|
1429
852
|
|
|
1430
853
|
Object with callbacks:
|
|
1431
854
|
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
855
|
+
```js
|
|
856
|
+
const callbacks = {
|
|
857
|
+
onStart: (response) => {
|
|
858
|
+
log('Offers started', response)
|
|
859
|
+
},
|
|
860
|
+
onOffersReceived: (response) => {
|
|
861
|
+
log('Offers received', response)
|
|
862
|
+
},
|
|
863
|
+
onComplete: (response) => {
|
|
864
|
+
log('Offers completed', response)
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
```
|
|
1443
868
|
|
|
1444
869
|
1. onStart()
|
|
1445
870
|
|
|
1446
|
-
Runs at the beginning of the each new offers request
|
|
871
|
+
Runs at the beginning of the each new offers request.\
|
|
1447
872
|
Returns adjusted and validated offers request parameters.
|
|
1448
873
|
|
|
1449
874
|
2. onOffersReceived()
|
|
1450
875
|
|
|
1451
|
-
Runs on every received batch of offers
|
|
1452
|
-
Returns hotel's offers (incomplete response).
|
|
876
|
+
Runs on every received batch of offers.\
|
|
877
|
+
Returns hotel\'s offers (incomplete response).
|
|
1453
878
|
|
|
1454
879
|
3. onComplete()
|
|
1455
880
|
|
|
1456
|
-
Runs after offers request complete
|
|
1457
|
-
Returns hotel's offers (complete response).
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
<a id="offers-response"></a>
|
|
881
|
+
Runs after offers request complete.\
|
|
882
|
+
Returns hotel\'s offers (complete response).
|
|
1461
883
|
|
|
1462
884
|
### Response
|
|
885
|
+
<a id="offers-response"></a>
|
|
1463
886
|
|
|
1464
887
|
An example of the response for request parameters:
|
|
1465
888
|
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
889
|
+
```js
|
|
890
|
+
const parameters = {
|
|
891
|
+
hotelId: '1926746',
|
|
892
|
+
checkIn: '2022-07-10',
|
|
893
|
+
checkOut: '2022-07-11',
|
|
894
|
+
rooms: '2'
|
|
895
|
+
}
|
|
896
|
+
```
|
|
897
|
+
|
|
898
|
+
```js
|
|
899
|
+
{
|
|
900
|
+
"anchorPriceRateBreakdown": {
|
|
901
|
+
"baseRate": 113.21,
|
|
902
|
+
"localTaxes": 8.64,
|
|
903
|
+
"taxes": 10.19,
|
|
904
|
+
"calculatedTotalRate": 132.04,
|
|
905
|
+
"nightlyRate": 132.04
|
|
906
|
+
},
|
|
907
|
+
"availableOffersCount": 19,
|
|
908
|
+
"fetchedAllOffers": false,
|
|
909
|
+
"hasMoreOffers": true,
|
|
910
|
+
"id": "1926746",
|
|
911
|
+
"offers": [
|
|
1473
912
|
{
|
|
1474
|
-
"
|
|
1475
|
-
"
|
|
1476
|
-
"localTaxes": 8.64,
|
|
1477
|
-
"taxes": 10.19,
|
|
1478
|
-
"calculatedTotalRate": 132.04,
|
|
1479
|
-
"nightlyRate": 132.04
|
|
913
|
+
"additionalProviderParams": {
|
|
914
|
+
"feedId": "1524856"
|
|
1480
915
|
},
|
|
1481
|
-
"
|
|
1482
|
-
"
|
|
1483
|
-
"
|
|
1484
|
-
"
|
|
1485
|
-
"
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
"proxyProviderCode": "BKS",
|
|
1506
|
-
"rateBreakdown": {
|
|
1507
|
-
"baseRate": 90.28,
|
|
1508
|
-
"localTaxes": 12.32,
|
|
1509
|
-
"taxes": 8.12
|
|
1510
|
-
},
|
|
1511
|
-
"roomID": "moc_08Ap8BcbIDg",
|
|
1512
|
-
"roomName": "Standard Double Room",
|
|
1513
|
-
"tags": ["top_offer"]
|
|
1514
|
-
}
|
|
1515
|
-
],
|
|
1516
|
-
"topOfferData": {
|
|
1517
|
-
"anchorPrice": 132.04,
|
|
1518
|
-
"anchorPriceNightly": 132.04,
|
|
1519
|
-
"offerIndexes": [0, 1, 2, 3]
|
|
1520
|
-
}
|
|
916
|
+
"availableRooms": 10,
|
|
917
|
+
"bookURI": "https://r.findhotel.net?...",
|
|
918
|
+
"calculatedTotalRate": 110.72,
|
|
919
|
+
"canPayLater": true,
|
|
920
|
+
"cug": null,
|
|
921
|
+
"currency": "EUR",
|
|
922
|
+
"hasAnchorPrice": true,
|
|
923
|
+
"hasFreeCancellation": true,
|
|
924
|
+
"id": "oO8jdRHaO8y0",
|
|
925
|
+
"isAnchorPriceOffer": false,
|
|
926
|
+
"isCheapest": false,
|
|
927
|
+
"isTopOffer": true,
|
|
928
|
+
"meals": ["breakfast"],
|
|
929
|
+
"nightlyRate": 110.72,
|
|
930
|
+
"providerCode": "BKS",
|
|
931
|
+
"proxyProviderCode": "BKS",
|
|
932
|
+
"rateBreakdown": {
|
|
933
|
+
"baseRate": 90.28,
|
|
934
|
+
"localTaxes": 12.32,
|
|
935
|
+
"taxes": 8.12
|
|
936
|
+
},
|
|
937
|
+
"roomID": "moc_08Ap8BcbIDg",
|
|
938
|
+
"roomName": "Standard Double Room",
|
|
939
|
+
"tags": ["top_offer"]
|
|
1521
940
|
}
|
|
1522
|
-
|
|
941
|
+
],
|
|
942
|
+
"topOfferData": {
|
|
943
|
+
"anchorPrice": 132.04,
|
|
944
|
+
"anchorPriceNightly": 132.04,
|
|
945
|
+
"offerIndexes": [0, 1, 2, 3]
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
```
|