Room Rates (Push)

Overview

This documentation provides details on how the Push service sends hotel rate information to the client when there are changes in the rates. The client needs to provide a Push URL and an API key for authentication.

Client Information

  • Push URL: Provided by the client.
  • API Key: Provided by the client.

Important Data Handling Guidelines

Complete State Updates

Each push contains the complete current state of hotel room availability and prices. Clients should replace their entire previous state with the new state, not merge or compare the data.

For example:

Yesterday's push:
- Room A: 10 USD
- Room B: 20 USD
- Room C: 30 USD

Today's push:
- Room A: 15 USD
- Room C: 35 USD

The correct way to handle this is to use today's push as the complete current state:

Current availability:
- Room A: 15 USD
- Room C: 35 USD

Do NOT merge with yesterday's data to keep Room B at 20 USD. Each push represents the complete current state of availability.

Empty Room Sets

If the rooms element is empty ([]), this indicates that there are no available rooms for the particular hotel. The client should handle this scenario by updating their system to reflect zero availability.

Push Service

How it Works

The service will push data to the client-provided URL whenever fresh hotel rates are retrieved. The data is sent in a JSON format, and the request includes the API key in the headers for authentication.

Response Requirements

  • On success: Return a status code < 400 (no specific response body required)
  • On error: Return a status code ≥ 400, optionally including a JSON error response
  • The service has a timeout of 5 minutes for each request

Best Practices for Clients

  • Handle requests with empty rooms data (rooms: []) correctly to mark hotels as unavailable
  • Each push contains the latest scraped data, representing the current state of hotel room availability and prices
  • Replace your entire previous state with the new state from each push

Payload

  • Smart Feed is using put http method during push requests.
  • The payload is a JSON object containing hotel rate details.
  • The whole schema for the payload is the same as described in /Pull/SmartFeedopen in new window section of docs.
  • While there's no strict limit, payloads are typically around 2MB. In rare cases, they can reach up to 50MB, depending on the number of hotels and the richness of their rate data.
  • Updates are pushed as soon as fresh data becomes available. For clients with many hotels and extensive rate data, updates may be delivered on a per-second basis. For smaller datasets, updates may occur less frequently, and longer intervals between pushes are expected.

Request sample

Below is an example of our HTTP request to your API with an example room and rate data:

PUT/ubio/rates
curl -X PUT 'https://your-domain.com/ubio/rates' \
    -H 'X-API-KEY: <YOUR-API-KEY>' \
    -H 'Content-Type: application/json' \
--data '
    [
      {
        "hotelId": "14885",
        "checkIn": "2022-02-15",
        "nights": 1,
        "guests": 2,
        "rooms": [
          {
            "name": "Standard Double/Twin",
            "id": "C-DBL-2",
            "description": "Room description, potentially long poorly formatted plain text",
            "images": [
              {
                "type": "Link",
                "name": "Imgname",
                "url": "http://example.com/room/image1.jpg"
              }
            ],
            "capacity": 2,
            "rates": [
              {
                "name": "BAR - 5% discount",
                "id": "5PCTBAR",
                "baseRate": {
                  "value": 16485,
                  "currencyCode": "chf"
                },
                "taxes": [
                  {
                    "type": "NamedPrice",
                    "name": "City Tax",
                    "code": "city-tax",
                    "price": {
                      "value": 16485,
                      "currencyCode": "chf"
                    }
                  }
                ],
                "fees": [
                  {
                    "type": "NamedPrice",
                    "name": "Hotel Fee",
                    "code": "hotel-fee",
                    "price": {
                      "value": 1234,
                      "currencyCode": "chf"
                    }
                  }
                ]
              }
            ]
          },
          {
            "name": "Superior Double/Twin",
            "id": "D-DBLS-2",
            "capacity": 2,
            "rates": [
              {
                "name": "BAR - 5% discount",
                "id": "5PCTBAR",
                "baseRate": {
                  "value": 16485,
                  "currencyCode": "chf"
                },
                "taxes": []
              }
            ]
          }
        ]
      },
      {
        "hotelId": "1ab2CD",
        "checkIn": "2022-02-15",
        "nights": 1,
        "guests": 2,
        "rooms": []
      }
    ]
'