Update Room (Daily)

This endpoint is used to update the room's price, availability and restrictions.
With this endpoint, PMS can update multiple rooms with multiple dates (Max: 90 dates) in one request.

Request

PUT https://app.hotelrunner.com/api/v2/apps/rooms/daily

// Example Request Snippet for JavaScript XHR

var data = JSON.stringify({
  "rooms": [
    {
      "inv_code": "HR:1903",
      "channel_codes": [
        "online"
      ],
      "dates": [
        {
          "date": "2016-12-08",
          "availability": "4"
        },
        {
          "date": "2016-12-09",
          "availability": "4"
        },
        {
          "date": "2016-12-10",
          "availability": "3"
        },
        {
          "date": "2016-12-11",
          "availability": "3"
        }
      ]
    }
  ]
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://app.hotelrunner.com/api/v2/apps/rooms/daily?token=TOKEN&hr_id=HR_ID");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("cache-control", "no-cache");
xhr.send(data);

The above command returns json structured like this:

    {
        "status": "ok", 
        "transaction_id": "123456789",
        "errors": []
    }

    or

    {
        "status": "try_again", 
        "transaction_id": "123456789"
        "errors": [ {"HR:1903": { "2017-01-01": "Invalid price"}}]
    }


Request Body

{
    "rooms": [
        {
            "inv_code": "HR:1903",
            "channel_codes": [
                "online"
            ],
            "dates": [
                {
                    "date": "2017-01-01",
                    "availability": "12",
                    "price": "400",
                    "min_stay": "2",
                    "stop_sale": "0",
                    "cta": "false",
                    "ctd": "false"
                },
                {
                    "date": "2017-04-01",
                    "availability": "12",
                    "price": "400",
                    "min_stay": "2",
                    "stop_sale": "0",
                    "cta": "false",
                    "ctd": "false"
                }
            ]
        }
    ]
}
Parameter Default Required Description
@rooms.inv_code - Yes Inv code that will be updated. ( Only updates the Room Type and its Master Rate )
@rooms.rate_code - Yes Rate code is used to update price of rates if it's 'price_update' is 'true'.If inv_code is also sent in the request, rate_code will be ignored and the request will only update the Room Type and its Master Rate.
@dates.availability - No Don't send this parameter if you don't want to update availability.
@dates - Yes Max 90 dates.
@dates.price - No Don't send this parameter if you don't want to update price.
@dates.stop_sale - No Don't send this parameter if you don't want to update stop sale. Accepted values: 1 or 0
@dates.cta - No Don't send this parameter if you don't want to update CTA. Accepted values: 1 or 0
@dates.ctd - No Don't send this parameter if you don't want to update CTD. Accepted values: 1 or 0
@dates.min_stay - No Don't send this parameter if you don't want to update min_stay.
@dates.date - Yes Format: YYYY-MM-DD Date
@rooms.channel_codes All connected channels of room No Type: Array Used to update specific channels. (eg. ['bookingcom', 'online'])

Get Transaction Details

This endpoint is used to fetch status logs of given transaction id.

GET https://app.hotelrunner.com/api/v2/apps/infos/transaction_details

// Example Request Snippet for JavaScript XHR

var data = null;

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://app.hotelrunner.com/api/v2/apps/infos/transaction_details?transaction_id={TRANSACTION_ID}&token={TOKEN}&hr_id={HR_ID}");
xhr.setRequestHeader("cache-control", "no-cache");

xhr.send(data);

The above command returns json structured like this:

{
  "transaction": {
    "id": "883770514",
    "counts": {
      "failed": 1,
      "succeeded": 1,
      "in_progress": 0
    },
    "details": [
      {
        "id": 12529,
        "channel_code": "bookingcom",
        "state": "failed",
        "name": "Люкс (68366) - Стандартный тариф - 1 Person",
        "code": "156754:8833301",
        "allocation_group": "8833301",
        "created_at": "2015-10-16T08:01:29Z",
        "pid": 9651,
        "error_message": null
      },
      {
        "id": null,
        "channel_code": "online",
        "state": "succeeded",
        "name": "Online",
        "code": "Online",
        "allocation_group": "Online",
        "created_at": "2015-10-16T07:54:25Z",
        "pid": null,
        "error_message": null
      }
    ]
  }
}

Query Parameters

Parameter Default Required Description
transaction_id - Yes Each room update request returns transaction_id.