API

Implementing Selfbook with SDK + API with API test cases

API - Use Cases:

1- Calendar

POST  /api/v1/hotels/{hotel_id}/calendar

API-key request header: 
API-Key: apikeyValue
Request Method: POST

An endpoint that returns prices for each date

📘

BEST PRACTICE

Calendar Pricing cannot exceed a 60 day period; it is recommended to request for every 60 days

Body Example

{
  "start_date": "2020-12-20",
  "end_date": "2020-12-22",
  "guests": [
    {
      "type": "adult",
      "count": 2
    }
  ],
  "property_id": null,
  "currency_code": "USD",
  "ada_compliant_rooms": false,
  "room_id": "SGL",
  "rate_plan_code": null,
  "rate_plan_filter_codes": [],
  "min_rate": 0,
  "max_rate": 1000,
  "promo_code": null,
  "group_code": null
}

Response Example

🚧

NOTE

Price null means that this date is sold-out.

{
  "data": [
    {
      "date": "string",
      "price": 0
    }
  ],
  "warnings": [
    "string"
  ]
}

2- Room Prices

POST  /api/v1/hotels/{hotel_id}/availability_summary

API-key request header: 
API-Key: apikeyValue
Request Method: POST

📘

BEST PRACTICE

We recommend requesting availability for all rooms in the grid view, and carry over the price to the room details page if opened from the grid, without submitting a separate request for the individual room.

Case 1 — Rooms grid page: No room ID required when requesting availability and price.

Case 2 — Rooms details page: In this case, room ID must be specified when requesting availability and price.