REST API Method: rates-and-availability/fetch

Fetches the base rates and/or availability of a listing and/or its units (types of guest rooms, units, and plans). Requires the parameters specified below. Request must be a POST. This method does not return the optional pricing rules that may have been set by the host and that are used when calculating the total cost quoted to travellers. For example: discount for long stays.

URL

http://api.bookingmarkets.com/rates-and-availability/fetch?api_key=your_key

Formats:

  • xml
  • json

HTTP Method(s):

  • POST
  • GET (maximum of 2048 characters) 

Requires Authentication:

true

API rate limited:

false

Parameters:

  • listing token="XXX". Required. Identifies the listing for which the rates and/or availability are being fetched. To obtain one, go to any of the sites in the BookingMarkets Network and then go to Host > Availability and Rates. You must be a manager of the listing, and the listing should be set to update its rates automatically. For testing purposes you can use the listingtoken czY2YnRPa0JFOE9QTXJpVU9ma0dWQT09
  • date from="YYYY-MM-DD" to="YYYY-MM-DD". Required. The date(s) for which you are fetching the rates and availability. For testing purposes you can use the listingtoken czY2YnRPa0JFOE9QTXJpVU9ma0dWQT09

Response

  • ok. The request was successfully processed.
    • timestamp. Timestamp of the transaction in UnixTime (GMT).
    • unittype id. Multiple occurrences possible. Identifies each one the types of units of the listing for which the rates and/or availability are being returned. To obtain the unit type ids, go to any of the sites of the BookingMarkets Network and then go to Host > Availability and Rates. You must be a manager of the listing, and the listing should be set to update its rates automatically.
      • date value. Multiple occurrences possible. The night for which the rates and availability are being returned.
      • currency. The currency in which the base rate is being returned following the ISO 4217 standard. The value will be empty if there isn't a base rate for this night.
      • baserate. The base rate for the given type of unit for the given night. The value will be empty if there isn't a base rate for this night.
      • closed. If 1, this type of unit is closed (also known as "sold out") for the given date. If 0, this type of unit is opened (also known as "available").
      • minimumstay. The minimum number of nights that travellers should book when booking a stay that includes the night of the given date.
      • unitsavailable. Number of units of this type that can still be sold by the sites of the BookingMarkets Network. If closed=1, no units of this type will be sold regardless of the value set in here.
  • error. The request wasn't successfully processed.
    • errorcode. Error code.
    • errormessage. Error message explaining the issue.

Examples

Request (XML):

http://api.bookingmarkets.com/rates-and-availability/fetch?api_key=your_key&xml=
<request>
     <listing token="czY2YnRPa0JFOE9QTXJpVU9ma0dWQT09"/>
     <date from="2020-10-10" to="2021-10-10"/>
</request>

Successful Response:

<?xml version="1.0" encoding="UTF-8"?>
<ok>
     <timestamp>1287186106</timestamp>
     <unittype id=3141592>
          <date value=2012-12-12>
               <currency>EUR</currency>
               <baserate>102.49</baserate>
               <closed>0</closed>
               <minimumstay>2</minimumstay>
               <unitsavailable>1</unitsavailable>
          </date>
          <date value=2012-12-13>
               <currency>EUR</currency>
               <baserate>99.49</baserate>
               <closed>1</closed>
               <minimumstay>1</minimumstay>
               <unitsavailable>1</unitsavailable>
          </date>
     </unittype>
     <unittype id=3141593>
          <date value=2012-12-12>
               <currency/>
               <baserate/>
               <closed>1</closed>
               <minimumstay>2</minimumstay>
               <unitsavailable>0</unitsavailable>
          </date>
          <date value=2012-12-13>
               <currency>EUR</currency>
               <baserate>59.99</baserate>
               <closed>1</closed>
               <minimumstay>4</minimumstay>
               <unitsavailable>5</unitsavailable>
          </date>
     </unittype>
</ok>

Failed Response:

<?xml version="1.0" encoding="UTF-8"?>
<error>
     <errorcode>0400a</errorcode>
     <errormessage>One of the dates provided is in the past: date: 2001-01-01. Please only use dates greater than or equal to today.</errormessage>
</error>

Sandbox

You can test your application using the following test listing:

Have questions or need help? We are eager to help. Contact us!