Async tasks
Overview
YSystem retrieves real-time information such as hotel rates from upstream services. Because these queries can take time, asynchronous tasks let you render partial results first and complete the response later.
- For hotel lists,
/hotel/searchcan return basic hotel information while prices are fetched in the background. - For hotel details,
/hotel/ratescan return the first rate plans while additional plans are fetched in the background.
How it works
Add the mode parameter to enable asynchronous processing. The response includes an asyncJobId together with the partial result.
Use that ID with the same route or /job/getResult to retrieve more data.
Asynchronous task modes
/hotel/search?mode=async
/hotel/searchresponse: Basic hotel information without prices./job/getResultresponse (or/hotel/searchwithasyncJobId): Basic hotel information and prices.
/hotel/rates?mode=asyncPaging
/hotel/ratesresponse: The first page of rate plans./job/getResultresponse (or/hotel/rateswithasyncJobId): The next page of rate plans, excluding the first page.
/hotel/rates?mode=asyncPagingMerged
/hotel/ratesresponse: The first page of rate plans./job/getResultresponse (or/hotel/rateswithasyncJobId): Both the first and next pages of rate plans.
For /hotel/rates, /job/getResult may return another asyncJobId when more pages are still being fetched. Continue calling /job/getResult until the response no longer contains asyncJobId.