[legacy] Lead rates from dynamic

For 3 modules, you need to get the rate asynchronously:

  • hotel

  • room

  • suite

For now, the official method is using what we call "dynamic", a way to access the backoffice unit data directly

It should be used only to get rates, no other data.

In the next months, this way of getting rates will be replaced

To get the rate, you need to do an POST request to the URL ${window._dynamic_base}/list/${window.websiteID}, with the module name, and specifying you need the rate field

Here is a jQuery version:

$.post(`${window._dynamic_base}/list/${window.websiteID}`, {
    module: 'hotel',
    'fields[]': 'rate',,
    'filters[*hotel.id]': '23,24' // Galaxy Hotel ID list separated by comma
}).then((response) => {
    console.log(response);

    // For each item, you can access the id and the rate. 
    // Do not use any other information from the response
});

Last updated