Wiki source code of 1. SearchHotelPrices
Last modified by Giorgi Mdivnishvili on 2024/11/06 10:47
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{box cssClass="floatinginfobox" title="**Contents**"}} | ||
2 | |||
3 | |||
4 | {{toc/}} | ||
5 | {{/box}} | ||
6 | |||
7 | = Method Description = | ||
8 | |||
9 | |||
10 | This method is specifically designed for the retrieval of hotel pricing information. It supports queries for both current date prices and for prices over a specified date range. | ||
11 | |||
12 | **Parameters:** | ||
13 | |||
14 | * stayDays (integer): Indicates the starting point of the stay duration in days. A default value of 0 signifies immediate date pricing retrieval. | ||
15 | * stayDaysTo (integer): Specifies the endpoint of the stay duration in days. The initial value is set to 0, indicating the system will fetch prices for the immediate date by default. | ||
16 | |||
17 | **Constraints:** | ||
18 | |||
19 | * The difference between stayDays and stayDaysTo must not exceed 7 days. This limitation is imposed to optimize the query performance and ensure the relevance of the returned data. | ||
20 | |||
21 | **Implementation:** | ||
22 | |||
23 | 1. **Query Initialization**: Begin by defining the stayDays and stayDaysTo parameters to frame your search criteria. These parameters enable the system to understand the desired duration for which the hotel pricing information is required. | ||
24 | 1. **Data Retrieval**: Execute the method with the provided parameters. The system processes the input and queries the database for hotel prices that match the specified duration, taking into account the constraint on the maximum duration difference. | ||
25 | 1. **Result Processing**: Upon successful retrieval, the system presents the hotel pricing data. This data is either for the current date (when both parameters are set to 0) or for the defined date range, adhering to the specified duration constraints. | ||
26 | |||
27 | **Example Usage:** (Examples of API calls or function usage would typically be provided here, demonstrating how to correctly implement the method to retrieve hotel prices based on immediate dates or a specified date range.) | ||
28 | |||
29 | **Notes:** | ||
30 | |||
31 | * This method ensures efficient access to hotel pricing information, catering to both immediate and short-term planning needs by leveraging a simple, parameter-driven query mechanism. | ||
32 | |||
33 | This documentation provides a detailed guide for developers on utilizing the hotel pricing retrieval method, emphasizing parameter usage, operational constraints, and the process flow for executing queries and handling results. | ||
34 | |||
35 | |||
36 | == Endpoint URL - [POST] == | ||
37 | |||
38 | {{info}} | ||
39 | [[https:~~/~~/integration.kazunion.com/api/OnlyHotelPackages/SearchHotelPrices>>https://integration.kazunion.com/api/OnlyHotelPackages/SearchHotelPrices]] | ||
40 | {{/info}} | ||
41 | |||
42 | |||
43 | == Request Parameters == | ||
44 | |||
45 | (% class="box infomessage" %) | ||
46 | ((( | ||
47 | None | ||
48 | ))) | ||
49 | |||
50 | == Request Body == | ||
51 | |||
52 | {{code language="Json"}} | ||
53 | { | ||
54 | "countryCode": "string", | ||
55 | "locations": [ | ||
56 | { | ||
57 | "type": "string", | ||
58 | "parent": "string", | ||
59 | "label": "string", | ||
60 | "subLabel": "string", | ||
61 | "value": "string", | ||
62 | "tag": "string" | ||
63 | } | ||
64 | ], | ||
65 | "checkInDate": "2023-12-14", | ||
66 | "checkInDateTo": "2023-12-14", | ||
67 | "checkOutDate": "2023-12-14", | ||
68 | "stayDays": 0, | ||
69 | "stayDaysTo": 0, | ||
70 | "adults": 0, | ||
71 | "children": 0, | ||
72 | "childrenAges": [ | ||
73 | 0 | ||
74 | ], | ||
75 | "extendedSearch": true, | ||
76 | "totalPriceFrom": 0, | ||
77 | "totalPriceTo": 0, | ||
78 | "recommended": true, | ||
79 | "popular": true, | ||
80 | "freeSale": true, | ||
81 | "groupByHotel": true, | ||
82 | "hotelCodes": [ | ||
83 | "string" | ||
84 | ], | ||
85 | "mealPlans": [ | ||
86 | "string" | ||
87 | ], | ||
88 | "hotelClasses": [ | ||
89 | "string" | ||
90 | ], | ||
91 | "hotelTypes": [ | ||
92 | "CityHotel" | ||
93 | ], | ||
94 | "hotelServices": [ | ||
95 | "HasAlcohol" | ||
96 | ], | ||
97 | "pagingId": "string", | ||
98 | "pageNumber": 0, | ||
99 | "pageRowCount": 0 | ||
100 | } | ||
101 | {{/code}} | ||
102 | |||
103 | == Request Body example == | ||
104 | |||
105 | |||
106 | {{code language="Json"}} | ||
107 | { | ||
108 | "countryCode": "AE", | ||
109 | "checkInDate": "2024-02-15", | ||
110 | "checkInDateTo": "2024-02-20", | ||
111 | |||
112 | "stayDays": 4, | ||
113 | "stayDaysTo": 6, | ||
114 | "adults": 1, | ||
115 | "children": 1, | ||
116 | "childrenAges": [ | ||
117 | 1 | ||
118 | ], | ||
119 | "extendedSearch": false, | ||
120 | "totalPriceFrom": 10, | ||
121 | "totalPriceTo": 10000, | ||
122 | "recommended": false, | ||
123 | "popular": true, | ||
124 | "freeSale": true, | ||
125 | "groupByHotel": true, | ||
126 | "hotelCodes": [ | ||
127 | |||
128 | ], | ||
129 | "mealPlans": [ | ||
130 | |||
131 | ], | ||
132 | "hotelClasses": [ | ||
133 | |||
134 | ], | ||
135 | "hotelTypes": [ | ||
136 | |||
137 | ], | ||
138 | "hotelServices": [ | ||
139 | |||
140 | ], | ||
141 | "pagingId": "", | ||
142 | "pageNumber": 3, | ||
143 | "pageRowCount": 10 | ||
144 | } | ||
145 | {{/code}} | ||
146 | |||
147 | == Response Body == | ||
148 | |||
149 | {{code language="json"}} | ||
150 | [ | ||
151 | { | ||
152 | "hotelCode": "string", | ||
153 | "hotelName": "string", | ||
154 | "hotelClass": "string", | ||
155 | "cityUID": "3fa85f64-5717-4562-b3fc-2c963f66afa6", | ||
156 | "countryCode": "string", | ||
157 | "countryName": "string", | ||
158 | "districtUID": "3fa85f64-5717-4562-b3fc-2c963f66afa6", | ||
159 | "cityName": "string", | ||
160 | "districtName": "string", | ||
161 | "hotelType": "CityHotel", | ||
162 | "latitude": "string", | ||
163 | "longitude": "string", | ||
164 | "hasAlcohol": true, | ||
165 | "hasFreeWifi": true, | ||
166 | "hasMetro": true, | ||
167 | "hasPool": true, | ||
168 | "hasMall": true | ||
169 | } | ||
170 | ] | ||
171 | {{/code}} | ||
172 | |||
173 | |||
174 | === Response Body example === | ||
175 | |||
176 | {{code language="Json"}} | ||
177 | { | ||
178 | "packages": [ | ||
179 | { | ||
180 | "id": "onlyhotel:c4e23e7e-3d54-4efa-a3db-88508230ce91:504f63ca-6dd5-4d84-8245-cf7e77ccff73", | ||
181 | "priceCurrency": "USD", | ||
182 | "totalPrice": 381.7, | ||
183 | "agentCommissionPercent": 0.0, | ||
184 | "agentCommissionAmount": 0.0, | ||
185 | "hotel": { | ||
186 | "hotelPriceId": "504f63ca-6dd5-4d84-8245-cf7e77ccff73", | ||
187 | "providerId": 13, | ||
188 | "hotelName": "Golden Tulip Al Barsha Hotel", | ||
189 | "hotelCode": "ed0820c5-29b0-4e1b-8bcf-9f3c181e7961", | ||
190 | "nigths": 4, | ||
191 | "mealPlan": "RO", | ||
192 | "hotelClass": "4", | ||
193 | "availabilityType": "FreeSale", | ||
194 | "availableRoomsCount": 0, | ||
195 | "fewRooms": true, | ||
196 | "roomCategoryCode": "e63ea5ac-4883-4059-bb0a-795a534bbbfb", | ||
197 | "roomCategoryName": "Superior Twin", | ||
198 | "placementTypeName": "SNGL + CHILD(6-11.99)sharing", | ||
199 | "checkInDate": "2024-02-17T08:00:00.000Z", | ||
200 | "checkOutDate": "2024-02-21T08:00:00.000Z", | ||
201 | "adults": 1, | ||
202 | "children": 1, | ||
203 | "districtUID": "4c65f6ed-902b-4fd8-9419-af7884c22c5e", | ||
204 | "districtName": "Al Barsha", | ||
205 | "cityUID": "f5185fa3-3f56-44ed-bf6b-80386a33caa2", | ||
206 | "cityName": "Dubai", | ||
207 | "countryCode": "AE", | ||
208 | "countryName": "United Arab Emirates", | ||
209 | "hasAlcohol": true, | ||
210 | "hasFreeWifi": true, | ||
211 | "hasMetro": false, | ||
212 | "hasPool": true, | ||
213 | "hasMall": false, | ||
214 | "cancellationPolicyDescription": "Cancellation Policy: 15 Day Before Arrival: 100.00 %, Early Departure: 100.00 %, NoShow: 100.00 %", | ||
215 | "cancellationPolicy": { | ||
216 | "noShowChargeValue": 100.0, | ||
217 | "noShowChargeValueType": "%", | ||
218 | "earlyDepartureChargeValue": 100.0, | ||
219 | "earlyDepartureChargeValueType": "%", | ||
220 | "conditions": [ | ||
221 | { | ||
222 | "timeunits": 15, | ||
223 | "timeunitType": "Day", | ||
224 | "timeOffsetTypeName": "Before Arrival", | ||
225 | "chargeValue": 100.0, | ||
226 | "chargeValueType": "%" | ||
227 | } | ||
228 | ] | ||
229 | } | ||
230 | }, | ||
231 | "extraServices": [] | ||
232 | }, | ||
233 | {{/code}} | ||
234 | |||
235 | |||
236 | === Schema === | ||
237 | |||
238 | {{success}} | ||
239 | SearchOnlyHotelPackagesResponse{ | ||
240 | |||
241 | |packages|[ | ||
242 | nullable: trueOnlyHotelPackage{((( | ||
243 | |id|string | ||
244 | nullable: true | ||
245 | |priceCurrency|string | ||
246 | nullable: true | ||
247 | |totalPrice|number($double) | ||
248 | |agentCommissionPercent|number($double) | ||
249 | |agentCommissionAmount|number($double) | ||
250 | |hotel|PackageHotel{((( | ||
251 | |hotelPriceId|string | ||
252 | nullable: true | ||
253 | |providerId|integer($int32) | ||
254 | |hotelName|string | ||
255 | nullable: true | ||
256 | |hotelCode|string | ||
257 | nullable: true | ||
258 | |nigths|integer($int32) | ||
259 | |mealPlan|string | ||
260 | nullable: true | ||
261 | |hotelClass|string | ||
262 | nullable: true | ||
263 | |availabilityType|RoomAvailabilityTypeEnumstringEnum: | ||
264 | [ OnRequest, FreeSale, StopSale ] | ||
265 | |availableRoomsCount|integer($int32) | ||
266 | |fewRooms|boolean | ||
267 | |roomCategoryCode|string | ||
268 | nullable: true | ||
269 | |roomCategoryName|string | ||
270 | nullable: true | ||
271 | |placementTypeName|string | ||
272 | nullable: true | ||
273 | |placementDescription|string | ||
274 | nullable: true | ||
275 | |checkInDate|string($date-time) | ||
276 | |checkOutDate|string($date-time) | ||
277 | |adults|integer($int32) | ||
278 | |children|integer($int32) | ||
279 | |districtUID|string($uuid) | ||
280 | nullable: true | ||
281 | |districtName|string | ||
282 | nullable: true | ||
283 | |cityUID|string($uuid) | ||
284 | nullable: true | ||
285 | |cityName|string | ||
286 | nullable: true | ||
287 | |countryCode|string | ||
288 | nullable: true | ||
289 | |countryName|string | ||
290 | nullable: true | ||
291 | |hasAlcohol|boolean | ||
292 | |hasFreeWifi|boolean | ||
293 | |hasMetro|boolean | ||
294 | |hasPool|boolean | ||
295 | |hasMall|boolean | ||
296 | |cancellationPolicyDescription|string | ||
297 | nullable: true | ||
298 | |cancellationPolicy|CancellationPolicyExchange{((( | ||
299 | |cancellationPolicyCode|string | ||
300 | nullable: true | ||
301 | |noShowChargeValue|number($double) | ||
302 | nullable: true | ||
303 | |noShowChargeValueType|string | ||
304 | nullable: true | ||
305 | |earlyDepartureChargeValue|number($double) | ||
306 | nullable: true | ||
307 | |earlyDepartureChargeValueType|string | ||
308 | nullable: true | ||
309 | |conditions|[ | ||
310 | nullable: trueCancellationPolicyConditionExchange{((( | ||
311 | |timeunits|integer($int32) | ||
312 | |timeunitType|string | ||
313 | nullable: true | ||
314 | |timeOffsetTypeName|string | ||
315 | nullable: true | ||
316 | |chargeValue|number($double) | ||
317 | nullable: true | ||
318 | |chargeValueType|string | ||
319 | nullable: true | ||
320 | |||
321 | }] | ||
322 | ))) | ||
323 | |||
324 | } | ||
325 | ))) | ||
326 | |||
327 | } | ||
328 | ))) | ||
329 | |extraServices|[ | ||
330 | nullable: trueHotelExtraServiceBase{((( | ||
331 | |extraServiceCode|string | ||
332 | nullable: true | ||
333 | |extraServiceTypeCode|string | ||
334 | nullable: true | ||
335 | |isMandatory|integer($int32) | ||
336 | |extraServiceName|string | ||
337 | nullable: true | ||
338 | |minimalServiceAmount|number($double) | ||
339 | |includedPriceCode|string | ||
340 | nullable: true | ||
341 | |prices|[ | ||
342 | nullable: trueHotelExtraServicePriceBase{((( | ||
343 | |extraServicePriceCode|string | ||
344 | nullable: true | ||
345 | |displayName|string | ||
346 | nullable: true | ||
347 | |restrictionInfo|string | ||
348 | nullable: true | ||
349 | |additionalInfo|string | ||
350 | nullable: true | ||
351 | |price|number($double) | ||
352 | |extraPrice|number($double) | ||
353 | |currency|string | ||
354 | nullable: true | ||
355 | |||
356 | }] | ||
357 | ))) | ||
358 | |||
359 | }] | ||
360 | ))) | ||
361 | |||
362 | }] | ||
363 | ))) | ||
364 | |pagingId|string | ||
365 | nullable: true | ||
366 | |pageNumber|integer($int64) | ||
367 | |pageCount|integer($int64) | ||
368 | |||
369 | } | ||
370 | {{/success}} | ||
371 | |||
372 | |||
373 | == Definitions == | ||
374 | |||
375 | |||
376 | === Paging and Caching === | ||
377 | |||
378 | During the first request, Paging id must be empty like this ( "pagingId": "",) pagenumber is the number of the page, pagerowcount means number of the given result in one page. So in the first request we can search like this: | ||
379 | |||
380 | |||
381 | first request | ||
382 | |||
383 | {{code language="Json"}} | ||
384 | { | ||
385 | "pagingId": "", | ||
386 | "pageNumber": 1, | ||
387 | "pageRowCount":10 | ||
388 | } | ||
389 | {{/code}} | ||
390 | |||
391 | |||
392 | ==== Request with caching ==== | ||
393 | |||
394 | as we receive response, in the end we can see pagingId- number, chich we can use for caching, and then just switch pagenumbers. for cleaning cache, it's important to make new request without pagingID | ||
395 | |||
396 | {{code language="Json"}} | ||
397 | { | ||
398 | "pagingId": "80", | ||
399 | "pageNumber": 1, | ||
400 | "pageRowCount":10 | ||
401 | } | ||
402 | {{/code}} | ||
403 | |||
404 | |||
405 | **Overview:** The Paging and Caching mechanism is designed to efficiently manage data retrieval in a paginated format. This mechanism is essential for handling large datasets by dividing the data into manageable pages, thereby optimizing the performance and scalability of data retrieval operations. | ||
406 | |||
407 | **Initial Request:** | ||
408 | |||
409 | * **Purpose**: The first request initiates the paging process and is designed to fetch the initial set of data without utilizing a pagingId. | ||
410 | * **Parameters**: | ||
411 | ** pagingId: Should be set to an empty string ("") to indicate that this is the initial request. | ||
412 | ** pageNumber: Indicates the specific page of data to retrieve, starting with 1. | ||
413 | ** pageRowCount: Specifies the number of results to be included on each page. | ||
414 | |||
415 | **Example - First Request**: | ||
416 | |||
417 | {{{{ | ||
418 | "pagingId": "", | ||
419 | "pageNumber": 1, | ||
420 | "pageRowCount": 10 | ||
421 | } | ||
422 | }}} | ||
423 | |||
424 | |||
425 | **Subsequent Requests with Caching:** | ||
426 | |||
427 | * **Purpose**: Following the initial data retrieval, subsequent requests utilize the pagingId obtained from the previous response. This pagingId serves as a cache identifier, enabling the system to quickly access the relevant dataset and efficiently paginate through the data. | ||
428 | * **Cache Utilization**: | ||
429 | ** Upon receiving a response, a pagingId value is provided. This pagingId should be used in subsequent requests to reference the cached data. | ||
430 | ** To navigate through the dataset, adjust the pageNumber while keeping the pagingId constant. | ||
431 | ** To refresh the dataset and clear the cache, initiate a new request without a pagingId. | ||
432 | |||
433 | **Example - Request with Caching**: | ||
434 | |||
435 | {{{ { | ||
436 | "pagingId": "80", | ||
437 | "pageNumber": 2, // Adjusted to fetch the next page | ||
438 | "pageRowCount": 10 | ||
439 | } | ||
440 | }}} | ||
441 | |||
442 | |||
443 | **Cache Management:** | ||
444 | |||
445 | * Clearing the cache and fetching a fresh set of data requires sending a new request with the pagingId parameter omitted or set to an empty string. This action resets the pagination and caching context. | ||
446 | |||
447 | **Implementation Notes**: | ||
448 | |||
449 | * The paging and caching mechanism significantly enhances data retrieval efficiency by minimizing server load and optimizing response times. | ||
450 | * Developers should ensure that the pagingId is correctly managed between requests to maintain session continuity and data consistency. | ||
451 | |||
452 | This documentation outlines the procedural framework for implementing a robust paging and caching strategy within data retrieval systems, detailing parameter usage and operational best practices for both initial and subsequent data fetch operations. | ||
453 | |||
454 | |||
455 | |||
456 | == Update == | ||
457 | |||
458 | |||
459 | ~1. To identify whether the returned result is from a dynamic or static channel, a field "**isDynamic" **has been added to the response. This field can have a value of **TRUE **or **FALSE**. Accordingly, if the hotel is from a dynamic channel, the response will show **TRUE**. | ||
460 | |||
461 | |||
462 | {{code language="Json"}} | ||
463 | { | ||
464 | "isDynamic": false | ||
465 | } | ||
466 | |||
467 | { | ||
468 | "isDynamic": True | ||
469 | } | ||
470 | {{/code}} | ||
471 | |||
472 | |||
473 | == Important == | ||
474 | |||
475 | {{error}} | ||
476 | === Implementing Authorization in Subsequent Requests === | ||
477 | |||
478 | For every API request after the initial authentication, it's crucial to include the authorization token in the request header. This ensures your requests are authorized and can access the necessary resources. Here's how to properly include your token: | ||
479 | |||
480 | * **Header Key:** Authorization | ||
481 | * **Header Value:** Bearer [Your Token Here] - Use the bearer token provided in the initial authentication response. The authorization type should be specified as Bearer Token. | ||
482 | |||
483 | Additionally, to ensure your requests are properly formatted and recognized, include the following headers: | ||
484 | |||
485 | * **Content-Type:** Specify this header as application/json to indicate the format of the request body. | ||
486 | * **Header Key:** X-nugios-timezone | ||
487 | * **Header Value:** 240 - Adjust this value to match your local timezone offset in minutes. | ||
488 | |||
489 | Incorporating these headers with their respective values is essential for the successful processing of your API requests. | ||
490 | {{/error}} |