If in your user frontend search times are crucial we recommend to cache at least some information.
Remmenber the basic static data you must cache and update each month in your database:
Note, details request are NOT allowed to be used to build cache, only on customer demand.
Avail data is cached on HB side but detail requets are checking in real time with suppliers, causing a lot of traffic to suppliers worsening response times for all customers of even causing some suppliers to close our direct connection.
Remember:
Depending on needs different caching solutions could be used.
We can split the request of two types :
Just languages and countries mapping need to be cached, operational days, full content, questions, pricing and all needed will be from LIVE responses.
Good for clients that can’t expend much time/resources in the development.
The inconveniences is depending on HB server load and is limited of the request per second quota.
Just activities names/codes, modalities names/codes, operational dates, box office amount pricing and few more details need to be cached, all content is displayed from LIVE responses.
Could be valid for travel agencies that don’t need to have a full listing, once client is interested in one product, make LIVE details request go have full information.
Good for fast UI, minimum data caching (just portfolio).
The problem is that the prices are box office, not accurate ones, no images.
Full content is cached, also portfolio basic information such as activities names/codes, modalities names/codes, operational dates and box office amount pricing.
Could be valid for travel agencies that don’t need to have final pricing in the listing, once client is interested in one product, make LIVE details request go have full information.
Good for fast UI, Full content available
The problem is that the prices are box office, not accurate ones, no images.
Display listing to final customer form cached data.
Once final clients chooses a service form the listing, display all cached detailed data (modalities/sessions/languages, operational dates and full content).
Meanwhile (displaying all cached detailed data to final customer), you can:
- Send a details request in order to update all information form LIVE response.
- OR wait final customer to select (modality, date, session or language) then, send details request in order to update all information form LIVE response.
Good for fast UI, Full content, pricing, operational dates basically all information is cached.
Recommended for clients that wants the fastest UI as possible or have high customer requests per second.
See an example of how make full cache (we assume you already have basic maping done, as counties, destination, languages...)
GET https://api.test.hotelbeds.com/activity-cache-api/1.0/portfolio?destination=PMI&offset=1&limit=1000
You cache all basic information.
Remenber to get al the records, the response header "X-Total-Count" will the return the total number of records.
You can request al the returned ones, or just the desired ones.
{
"language": "en",
"filters": [
{
"searchFilterItems": [
{
"type": "service",
"value": "E-E10-A0AANO0335"
}
]
},
/*!!! UP TO 100 per request !!!*/
},
{
"searchFilterItems": [
{
"type": "service",
"value": "E-E10-NTASVQMONU"
}
]
}
],
"paxes": [
{
"age": 30
}
],
"from": "2021-05-11",
"to": "2021-05-22",
"pagination": {
"itemsPerPage": 100,
"page": 1
},
"order": "DEFAULT"
}
The response will return all data of each available activity so you can build the complete cache.
You just need to display cached data to final customers until they are interested in one particular product, then you must make a details request in order to obtain valid ratekey an updated data, and finally confirmation.