Search Accommodations
The accommodation search API is used to search the basic price of all accommodations within your administration or even within your campsite group. You can add filters, aggregations to also filter the data so you only get the accommodations which are filtered.
The accommodation price will be calculated on the arrival and departure which is provided. The number of available places will also be available
Headers
If you have a chain or ota account it is possible to filter the results on Administration level. You can then add the X-Admin-Id header to request the data for a specific Administration
If you not provide the X-Admin-Id we will search on all the Administrations which are connected to the channel
- X-Admin-Id (optional): If you want to calculate for a specific administration you have to provide this header
Parameters
Arrival Departure
There are some required parameters to calculate a price. These are the arrival and departure date.
Specific accommodations
Then the accommodation_id is a option and can be found on each accommodation in the interface or by the Accommodations API.
The persons
For the definition of the number of persons you can choose between:
- Age Tables (Camping.care age tables)
- Birthdates
- Persons
If these parameters are not provided then the default number of 2 persons will be selected in the highest prioritized age table
Filtering
You can use filtering to filter specific accommodations. This can be done by using tags, labels, accommodation type and minimum or maximum persons. Each filter in an array can have multiple values.
Each array item is an "AND" value and each value within the filter is used as an "OR" statement.
For example:
filters[0] : {"key" : "tags", "value" : [1, 2]}
filters[0] : {"key" : "tags", "value" : [3, 4]}
This will mean tag id 1 OR 2 AND tag id 3 OR 4 should be connected in the accommodation For more exaples on filtering there is more in the api reference documentation. (See below)
Aggregations
You can use aggragtions to check the number of specific values which have been found in the query. For exaple you could use the "tags" aggregation to get a count on all tags which have been found in the filter.
All Parametes
- arrival (required, format: YYYY-MM-DD): The arrival day of the price you want to calculate.
- departure (required, format: YYYY-MM-DD): The departure day of the price you want to calculate
- accommodation_id (optional): The accommodation id of the accommodation you want to calculate
- filters (optional, format array): An array of filters, check the API reference documentation for examples
- aggregations (optional):
Read the API Reference documentation here
Results
The result will show you the data of the accommodations:
{
"total_doc_count": 2,
"accommodations": [
{
"id": 10589,
"admin_id": 6374,
"price": 120,
"available_objects": 16,
"data": {// accommodation data }
},
{
"id": 10596,
"admin_id": 6374,
"price": 150,
"available_objects": 2,
"data": {// accommodation data }
}
]
}
In this example we have received a result of 2 accommodations
The accommodations will be shown in the array.
Each accommodation will contain the next parameters
- id: Accommodation id
- admin_id: The administration id the accommodation belongs to
- price: The price for the stay requested
- available_objects: The number of pitches which are still available in the requested period
- data: The data object for the accommodation, this contains the name, descriptions, media, tags, labels, prices etc.