Master Price Lists
Each type in Booking Experts is associated to a Master price list. A master price list can consist of simple (night) prices or complex (LOS) prices. To support dynamic price updates, apps can manage these master price lists if they have the master_price_list|write
permission. This guide explains how you can define and update prices of master price lists.
Creating a master price list
An app can create master price lists using the endpoint POST master_price_list. Only a name is required; you do not need to provide any prices now (but it is possible). The administration can associate this price list to any existing type.
To keep in mind
With the permission
master_price_list|write
, any master price list within the administration can be updated. However, the recommendation is to create a separate price list instead to ensure manually defined price lists are not overwritten by accident.
Sideposting prices
Prices of master price lists can only be created or updated in bulk by using Sideposting. Sideposting will allow you to define prices using the standard JSONAPI included array. Prices are upserted by checking for existing resources based on date
and length_of_stay
(for complex prices). You don't need to specify an ID for these prices, but in order to link these resources in your input, you need to define /meta/temp_id
. Also /meta/method
must be set to create as a logical consequence of the missing IDs.
Creating a master price list
The example below created a new Master price list with name 'My master price list'. The master price list will be returned in the response if successful.
//Endpoint: POST master_price_list
{
"data": {
"type": "master_price_list",
"attributes": {
"name": "My master price list"
}
}
}
}
Updating a master price list's simple prices
The example below updates a Master price list with some simple prices. The master price list will be returned in the response if successful.
Endpoint : PATCH master_price_list
{
"data": {
"id": "1",
"type": "master_price_list",
"relationships": {
"simple_prices": {
"data": [{
"type": "simple_price",
"meta": {
"temp_id": "price1",
"method": "create"
}
}, {
"type": "simple_price",
"meta": {
"temp_id": "price2",
"method": "create"
}
}]
}
}
},
"included": [{
"type": "simple_price",
"attributes": {
"date": "2014-01-01",
"price": {
"currency": "EUR",
"value": "12.75"
}
},
"meta": {
"temp_id": "price1"
}
}, {
"type": "simple_price",
"attributes": {
"date": "2014-01-02",
"price": {
"currency": "EUR",
"value": "14.15"
}
},
"meta": {
"temp_id": "price2"
}
}]
}
Updating a master price list's complex prices
The example below updates a Master price list with some complex prices. The master price list will be returned in the response if successful.
//Endpoint: PATCH master_price_list
{
"data": {
"id": "1",
"type": "master_price_list",
"relationships": {
"complex_prices": {
"data": [{
"type": "complex_price",
"meta": {
"temp_id": "price1",
"method": "create"
}
}, {
"type": "complex_price",
"meta": {
"temp_id": "price2",
"method": "create"
}
}]
}
}
},
"included": [{
"type": "complex_price",
"attributes": {
"arrival_date": "2014-01-01",
"length_of_stay": 7,
"price": {
"currency": "EUR",
"value": "12.75"
}
},
"meta": {
"temp_id": "price1"
}
}, {
"type": "complex_price",
"attributes": {
"arrival_date": "2014-01-15",
"length_of_stay": 5,
"price": {
"currency": "EUR",
"value": "14.15"
}
},
"meta": {
"temp_id": "price2"
}
}]
}
Updated 10 months ago