This endpoint is used to update calendar of a given room. For example, you can toggle the availability state of the room, update price for a single or multiple dates, adding notes, etc. To update the calendar, you must specify the date interval first. Then you can optionally filter that interval by date of week (Monday through Sunday) or by weekend (Friday, Saturday and Sunday) / nonweekend (Monday through Thursday).
Method | URI | Headers |
---|---|---|
POST | /api/rooms/{room}/calendar | Authorization: Bearer <token> Accept: application/json |
Param | Description | Type | Required |
---|---|---|---|
start_date | The starting of the selected date range. This parameter is required if the dates parameter is empty.The date format should be d-m-Y and the date should be after or equal to today. | Date | Yes (without dates ) |
end_date | The ending of the selected date range. This parameter is required if the dates parameter is empty.The date format should be d-m-Y and the date should be after or equal to start_date . | Date | Yes (without dates ) |
dates | The list of dates used to update the calendar. If this parameter is presented, you don't need to specify start_date and end_date . The date format should be d-m-Y. | Array | No |
calendar_status | The status of all dates in selected range. Accepted values are: Available, Not available, and Booking | String | Yes |
price | The format should match this regular expression: /^[\pN,\.]+$/u (PHP).This parameter is required if the calendar_status is Availableand not all selected dates are in blocking state (having Not Available or Booking status) | String | Yes |
currency_code | Can be VND or USD | String | Yes |
interval | Accepted values are weekend, nonweekend and, daily. This key is optional and may only have a single value. If days parameter is available, the value of this keyshould be an empty string. | String | Yes (without days ) |
days | An array of week days. Accepted values are monday, tuesday, wednesday, thursday, friday, saturday, and sunday. This key is optional and may have multiple values. If interval parameter is available, the value of this keyshould be an empty array. | String | Yes (without interval ) |
all_blocking | Can be a boolean value. Determine if all the dates in the selected range is blocking (have the status of Not available or Booking) | Boolean | No |
notes | The notes for all dates | String | No |
calendar_start_date | The starting date of the current calendar view. The date format should be d-m-Y. | Date | No |
calendar_end_date | The ending date of the current calendar view. The date format should be d-m-Y. | Date | No |
Param | Description | Type | Required |
---|---|---|---|
{room} | The ID of a given room | Integer | Yes |
Example request
curl \
--request POST \
--url https://api.luxstay.com/api/rooms/10777/calendar \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--form start_date=28-10-2018 \
--form end_date=10-11-2018 \
--form calendar_status=Available \
--form price=45 \
--form interval=weekend \
--form 'days[0]=monday' \
--form 'days[1]=tuestday' \
--form calendar_start_date=30-07-2018 \
--form calendar_end_date=10-09-2018 \
--form all_blocking=0 \
--form currency_code=VND \
--form 'notes=updating price'
Example response
{
"message": "The calendar of the room has been updated successfully."
}
Reason invalid access token
Example response
{
"message": "Unauthenticated."
}
Reason unauthorized to update room calendar
Example response
{
"message": "You are not allowed to access or change information associated with this room."
}
Reason cannot find the given room
Example response
{
"message": "Cannot find the given room"
}
Reason validation errors
Example response
{
"message": "The given data was invalid.",
"errors": {
"start_date": [
"The start date field is required when dates is not present."
]
}
}
{
"message": "The given data was invalid.",
"errors": {
"start_date": [
"The start date must be a date after or equal to today."
]
}
}
{
"message": "The given data was invalid.",
"errors": {
"price": [
"Invalid money value/format provided."
]
}
}
{
"message": "The given data was invalid.",
"errors": {
"currency_code": [
"The selected currency code is invalid."
]
}
}