Prices and restrictions

This endpoint allows you to import prices and restrictions.

Import prices and restrictions

POST https://api.mobile-calendar.com/get/pricing

This enpoint resturn the price list for date range as well as for given rooms.

Headers

NameTypeDescription

Authorization

string

API login and password are required header parameters for authentication

Request Body

NameTypeDescription

from

string

"Date from" to import price list Correct format: YYYY-MM-DD

to

string

"Date to" to import price list Correct format: YYYY-MM-DD

room_ids

array

Room IDs for which the price list should be imported. This field is not required. If it is not set, the API will return prices for all rooms.

{
    "status": "success",
    "data": {
        "currency": "PLN",
        "rooms": {
            "5630": {
                "room_name": "Room1",
                "pricing_type": "PRICE_PER_ROOM",
                "prices_and_restrictions": {
                    "2021-01-01": {
                        "price": "200",
                        "min_stay": "3",
                        "max_stay": "30",
                        "avail_arrival": "1",
                        "avail_departure": "1",
                        "discount": {
                            "min_stay": "7",
                            "price": "10",
                            "type": "1"
                        }
                    },
                    "2021-01-02": {
                        "price": "200",
                        "min_stay": "3",
                        "max_stay": "30",
                        "avail_arrival": "1",
                        "avail_departure": "1",
                        "discount": {
                            "min_stay": "7",
                            "price": "10",
                            "type": "0"
                        }
                    }
                }
            },
            "5645": {
                "room_name": "Room2",
                "pricing_type": "DERIVED_PRICE_MODEL",
                "prices_and_restrictions": {
                    "2021-01-01": {
                        "price": "200"
                    },
                    "2021-01-02": {
                        "price": "200"
                    }
                },
                "options": {
                    "leading_occupancy": "3",
                    "persons": [
                        {
                            "person": 2,
                            "type": "%",
                            "prefix": "-",
                            "amount": "30"
                        },
                        {
                            "person": 1,
                            "type": "%",
                            "prefix": "-",
                            "amount": "50"
                        }
                    ]
                }
            }
        }
    }
}

Example of request

The request below gets prices for January 1, 2021, through January 2, 2021 and for rooms with ID 5630 and 5645.

If there is no room_ids parameter, the API will return prices for all rooms.

{
    "from" : "2021-01-01", 
    "to" : "2021-01-02",
    "room_ids" : [5630, 5645]
}

You can find the room ID in the rooms details form.

The price list object

Field

Level

Type

Description

status

L0

string

Responsne status success | errror

errors

L0

array

Informations about errors

data

L0

object

Main object "Pricing"

currency

L1

string(3)

Price list currency, 3-character currency format compatilbe withISO 4217 Standard

room

L1

array

List of rooms, the key of given room is it's ID

room_name

L3

string

Room name

pricing_type

L3

string

Type of price list. Allowed formats:

PRICE_PER_ROOM | PRICE_PER_PERSON | DERIVED_PRICE_MODEL

options

L3

array

Prices for different person. Only available in the pricing model DERIVED_PRICE_MODEL

leading_occupancy

L4

integer

Leading occupancy. Only occur with the parent field options

persons

L4

array

Individual options. Only occur with the parent field options

person

L5

integer

Number of people referenced by prices

type

L5

string

Indicates whether the discount is to be a percentage or an amount. Formats:

additional - currency / amount discount

% - percentage discount

prefix

L5

string(1)

Indicates whether the amount should be negative or positive. Formats: + | -

amount

L5

float

Amount, correct format: 100 | 100.00

prices_and_restrictions

L3

array

Prices and restrictions for a given day, the key of a given day is its date

price

L5

float

Price, correct format: 100 | 100.00

min_price

L5

float

Minimal price, Only available in the pricing model PRICE_PER_PERSON correct format: 100 | 100.00

price_child

L5

float

Price for a child, Only available in the pricing modelPRICE_PER_PERSON correct format: 100 | 100.00

min_stay

L5

integer

Minimum period of stay

max_stay

L5

integer

Maximum period of stay

avail_arrival

L5

bool

Available arrival, format: 0 | 1

avail_departure

L5

bool

Available departure, format 0 | 1

discount

L5

array

Discount for the stay

discount.min_stay

L6

integer

The minimum period of stay for which the discount begins

discount.price

L6

float

Amount or % discount, correct format: 100 | 100.00

discount.type

L6

integer

Percentage or currency discount type.

0 - oznacza procentowy

1 - oznacza walutowy

Pricing models

"Price per room" pricing model. Means that the price per room is fixed, regardless of the number of people.

Troubleshooting

Informations about errors

Error

Description

Set date range. Field "From" and "To" is required.

FieldFrom and To are required parameters

Incorrect format of "From" and/or "To" fields. Correct format YYYY-MM-DD

Invalid date format. The correct format is: YYYY-MM-DD

"From" date can not be greater than or equal to "To" date.

Incorrect date "From" or "To"

Date From can not be greather than to date

Maximum date range is 90 days

The maximum range for dates is 90 days

Add room IDs

If you set room_idsparameter, then you must enter value

Wrong room IDs

You entered the wrong room ID or the rooms are not assigned to your account

An example of a respone with an error

HTTP status 200 OK.

Note that the HTTP 200 OK code does not mean the answer is correct at all!

{
    "status": "error",
    "data": [],
    "errors": [
        "Incorrect format of \"From\" and/or \"To\" fields. Correct format YYYY-MM-DD",
        "Incorrect date \"From\" or \"To\""
    ]
}

Last updated